Conversation
Al2Klimov
left a comment
There was a problem hiding this comment.
Your validator is named RegexValidator, though it doesn't validate a regex. It validates plain text as specified by a regex.
Moreover: I shall make a validator which actually validates a regex.
Let's agree upon names which both don't conflict and are obvious to lib users! Any suggestions?
|
What about |
I like that. What about |
Al2Klimov
left a comment
There was a problem hiding this comment.
Please rename to RegexMatchValidator.
a639f65 to
6ae76b7
Compare
9545d87 to
d20f7fb
Compare
|
Since this PR has been in the draft stage for quite some time, I wonder if we really have a use case for this validator. If so, I'd suggest we finish it. Otherwise, we can just close the PR. |
|
Yes, there are currently no use cases. |
Use caseIn https://git.icinga.com/aklimov/pocssooidc/-/merge_requests/1, I'd like to ensure that URLs start only with |
d20f7fb to
6280876
Compare
This comment was marked as resolved.
This comment was marked as resolved.
|
@cla-bot check |
This comment was marked as resolved.
This comment was marked as resolved.
65cb7e2 to
14da200
Compare
src/RegexMatchValidator.php
Outdated
| // Multiple isValid() calls must not stack validation messages | ||
| $this->clearMessages(); | ||
|
|
||
| $status = @preg_match($this->pattern, $value); |
There was a problem hiding this comment.
Couldn't you use RegexSyntaxValidator for that?
There was a problem hiding this comment.
Sure.
But while I'm on it, let's also question the code LOCATION of this kind of check. Shouldn't the syntax of the pattern, which (the pattern) is constant (relative to user input), be checked in the constructor and throw if necessary?
src/RegexMatchValidator.php
Outdated
| /** | ||
| * Create a RegexMatchValidator | ||
| * | ||
| * @param string|array $pattern |
c95b521 to
625e815
Compare
TODOs: