You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have extended webmozart/assert's code for my use case in which I want to know more detailed information about assertions. I do assertions inside my entities and would always like to know which entity and which property is invalid.
The implementation looks like this:
// Pass a string as "root" identifier
Assert::that('User', 'name', $nameValue)
->startsWith('Test')
->notEmpty();
// Or pass the object
Assert::that($user, 'name', $nameValue)
->startsWith('Test')
->notEmpty();
As you can see, I implemented an "assertion chain" here as well to avoid repeating the ::that(..) call.
Is this something that you can imagine being integrated into this library, or is this use case too specific? If yes, I'd be open to provide a PR.
The text was updated successfully, but these errors were encountered:
arjanfrans
changed the title
Assertions with info about which class/property is invalid.
Assertions with info about which class/property is invalid
Mar 30, 2022
I have extended webmozart/assert's code for my use case in which I want to know more detailed information about assertions. I do assertions inside my entities and would always like to know which entity and which property is invalid.
The implementation looks like this:
As you can see, I implemented an "assertion chain" here as well to avoid repeating the
::that(..)
call.Is this something that you can imagine being integrated into this library, or is this use case too specific? If yes, I'd be open to provide a PR.
The text was updated successfully, but these errors were encountered: