Skip to content

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
@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

5 participants