issues
search
webmozarts
/
assert
Assertions to validate method input/output with nice error messages.
MIT License
7.56k
stars
145
forks
source link
Add validRegexPattern assertions
#305
Open
zlodes
opened
3 weeks ago
zlodes
commented
3 weeks ago
Why?
PHP functions working with regex (
preg_match
,
preg_replace
, etc.) work in
legacy
way — they just return
false
instead of throwing exception.
The way to check if the string is regex is quite hacky, so, would be great to hide the check implementation somewhere.
References
https://stackoverflow.com/a/8825096/3578207
zlodes
commented
3 weeks ago
I see that some tests failed. Fixing. 🤔
Why?
preg_match
,preg_replace
, etc.) work in legacy way — they just returnfalse
instead of throwing exception.References