Skip to content

Regex parsing fixes for newline characters and marker verbs #3268

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

Merged
merged 3 commits into from
Jul 27, 2024

Conversation

Seldaek
Copy link
Contributor

@Seldaek Seldaek commented Jul 25, 2024

cc @staabm @mvorisek

@phpstan-bot
Copy link
Collaborator

You've opened the pull request against the latest branch 1.12.x. If your code is relevant on 1.11.x and you want it to be released sooner, please rebase your pull request and change its target to 1.11.x.

@Seldaek Seldaek changed the base branch from 1.12.x to 1.11.x July 25, 2024 21:05
Copy link
Contributor

@staabm staabm left a comment

Choose a reason for hiding this comment

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

lgtm - thanks

assertType('array{string, non-empty-string, non-empty-string, non-empty-string}', $matches);
}
if (preg_match('/foo(*:first)|bar(*:second)([x])/', $s, $matches)) {
assertType("array{0: string, 1?: non-empty-string, MARK?: 'first'|'second'}", $matches);
Copy link
Contributor

@staabm staabm Jul 26, 2024

Choose a reason for hiding this comment

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

should MARK be non-optional since we are sure here about the successfull match?
(in other words: should it be optional/non-optional depending on $wasMatched (or other alternation rules)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left it as such because it depends where the mark is https://3v4l.org/vJofm - and it seems to me not really worth the effort to ensure whether it's in a match group that is optional or not, given how niche this feature is.

@ondrejmirtes ondrejmirtes merged commit c0537db into phpstan:1.11.x Jul 27, 2024
447 of 455 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants