Skip to content
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

Add tryFromString method #557

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

Add tryFromString method #557

wants to merge 2 commits into from

Conversation

markinigor
Copy link

@markinigor markinigor commented Jun 7, 2024

Description

Add tryFromString method that

Motivation and context

It is usefull with deserialization json with optional|nullable uuid parameters.
And it similar to BackedEnum::tryFrom function, but with nullable param
https://www.php.net/manual/ru/backedenum.tryfrom.php

How has this been tested?

Copied tests from existing fromString testcase. Added test for null, empty string and invalid string

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.

@markinigor markinigor requested a review from ramsey as a code owner June 7, 2024 14:59
Copy link

codecov bot commented Aug 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.65%. Comparing base (d459bdb) to head (a1ad7e9).
Report is 32 commits behind head on 4.x.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                4.x     #557      +/-   ##
============================================
+ Coverage     95.64%   95.65%   +0.01%     
- Complexity      583      587       +4     
============================================
  Files            70       70              
  Lines          1560     1566       +6     
============================================
+ Hits           1492     1498       +6     
  Misses           68       68              
Files Coverage Δ
src/Uuid.php 98.13% <100.00%> (+0.11%) ⬆️

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.

1 participant