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
NodeNameResolver: Throw exception in BC breaking path #4980
Conversation
the failling build tells me we have still some work left in the codebase to compensate the removal of the regex matching ;) |
@staabm the target code can be updated with: if (str_contains($name, "*")) {
fnmatch()...
else
$this->isName() |
358f127
to
af242c3
Compare
rebased. |
@staabm please rebase once more :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems all green now :)
@@ -181,6 +186,12 @@ public function isStringName(string $resolvedName, string $desiredName): bool | |||
return $desiredName === $resolvedName; | |||
} | |||
|
|||
foreach(self::REGEX_WILDCARD_CHARS as $char) { | |||
if (str_contains($desiredName, $char)) { | |||
throw new ShouldNotHappenException('Matching of regular expressions is no longer supported. Use $this->getName() and compare with e.g. str_ends_with() or str_starts_with() instead.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fnmatch should mentioned:
throw new ShouldNotHappenException('Matching of regular expressions is no longer supported. Use $this->getName() and compare with e.g. str_ends_with() or str_starts_with() instead.'); | |
throw new ShouldNotHappenException('Matching of regular expressions is no longer supported. Use $this->getName() and compare with e.g. str_ends_with(), str_starts_with(), or fnmatch() instead.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fnmatch example https://3v4l.org/MkqgX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm.., this must be moved in last resort after return strcasecmp($resolvedName, $desiredName) === 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to exclude fnmatch() on purpose, as it's mostly related to paths, not node names. Also it's pain to use as * works only with specific constant :)
LGTM 👍
Thank you 👏 |
No description provided.