Skip to content

fromStrictString method #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: 4.x
Choose a base branch
from

Conversation

rogervila
Copy link

Description

Provide a new fromStrictString method that validates the string against the isValid method.

Motivation and context

Fix #531

How has this been tested?

The new method is covered by Unit tests.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

PR checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.

@rogervila
Copy link
Author

Hi @ramsey, looks like there is a python issue on the docs build step. Could you review it? thanks!

*
* @psalm-pure
*/
public function fromStrictString(string $uuid): UuidInterface;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interface changes will require a major version bump.

@ramsey
Copy link
Owner

ramsey commented Jan 26, 2024

@rogervila Thanks for the PR. Unfortunately, I'm unemployed without any income, and I'm spending every waking minute on job searching, so I'll be unable to give this much attention until I've sorted out my financial situation. Thank you for your understanding. 🙂

@rogervila rogervila marked this pull request as ready for review January 30, 2024 12:57
@rogervila
Copy link
Author

@rogervila Thanks for the PR. Unfortunately, I'm unemployed without any income, and I'm spending every waking minute on job searching, so I'll be unable to give this much attention until I've sorted out my financial situation. Thank you for your understanding. 🙂

Don't worry, first things first 🙂

@ramsey
Copy link
Owner

ramsey commented Apr 27, 2024

Can you provide some more details on when a user might use fromStrictString() instead of fromString()? I've read #531, but it sounds like an application-specific or domain-specific problem, rather than a library problem, since you want your application to be more strict than the library when creating UUIDs from strings.

Another problem is the introduction of a new interface method. This breaks BC and would need to wait until a later major version of this library.

@rogervila rogervila requested a review from ramsey May 29, 2025 09:49
Copy link

codecov bot commented Jun 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.13%. Comparing base (4e0e23c) to head (ae59c6e).

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                4.x     #533      +/-   ##
============================================
+ Coverage     95.11%   95.13%   +0.02%     
- Complexity      574      578       +4     
============================================
  Files            70       70              
  Lines          1637     1645       +8     
============================================
+ Hits           1557     1565       +8     
  Misses           80       80              
Files with missing lines Coverage Δ
src/Uuid.php 98.19% <100.00%> (+0.06%) ⬆️
src/UuidFactory.php 98.34% <100.00%> (+0.05%) ⬆️

@ramsey
Copy link
Owner

ramsey commented Jun 26, 2025

@rogervila Can you take a look at my comment from April last year and let me know your thoughts? I'm still not sure this is needed. Plus, it has a major BC break because of the interface change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent results between fromString and isValid methods.
2 participants