Skip to content

Add tryFromString method#557

Open
markinigor wants to merge 4 commits intoramsey:4.xfrom
markinigor:4.x
Open

Add tryFromString method#557
markinigor wants to merge 4 commits intoramsey:4.xfrom
markinigor:4.x

Conversation

@markinigor
Copy link
Copy Markdown

@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
@codecov
Copy link
Copy Markdown

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 42 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 with missing lines Coverage Δ
src/Uuid.php 98.13% <100.00%> (+0.11%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants