Skip to content
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

Assert there is no failure #1453

Merged
merged 1 commit into from
Aug 27, 2024
Merged

Assert there is no failure #1453

merged 1 commit into from
Aug 27, 2024

Conversation

greg0ire
Copy link
Member

The pattern is not dynamic, and we know it works. This addresses an issue reported by PHPStan.

The pattern is not dynamic, and we know it works. This addresses an
issue reported by PHPStan.
@greg0ire greg0ire added this to the 3.8.1 milestone Aug 27, 2024
@greg0ire greg0ire merged commit fb79c93 into doctrine:3.8.x Aug 27, 2024
9 checks passed
if (preg_match('~(.*)\\\\([^\\\\]+)~', $fqcn, $mch) === 0) {
$mch = [];
$matchResult = preg_match('~(.*)\\\\([^\\\\]+)~', $fqcn, $mch);
if ($matchResult === 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had the same problem in DBAL. If you change this check to…

if ($matchResult !== 1) {

… you should not need the assert. Alternatively, we could think about using the composer/pcre library which has a saner API.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@derrabus that's the solution I went first at first, but then I felt wrong because there's a tiny chance that false might occur and misdiagnose it as an invalid FQCN. composer/pcre might indeed be a good solution.

@greg0ire greg0ire deleted the fix-build branch August 28, 2024 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants