fix: fix support call-site generic variance#9253
fix: fix support call-site generic variance#9253kubawerlos merged 3 commits intoPHP-CS-Fixer:masterfrom
Conversation
|
Thank you ❤️ |
|
@kubawerlos Thank you for the quick fix! |
| * - and https://github.com/phpstan/phpdoc-parser/blob/1.26.0/src/Parser/PhpDocParser.php parser impl. | ||
| */ | ||
| private const REGEX_TYPE = '(?<type>(?x) # single type | ||
| (?:co(ntra)?variant\h+)? |
There was a problem hiding this comment.
| (?:co(ntra)?variant\h+)? | |
| (?:co(?:ntra)?variant\h+)? |
no capturing group needed, the regex should not have any unnamed capturing group in general
There was a problem hiding this comment.
no capturing group needed
👍🏻
the regex should not have any unnamed capturing group in general
can we somehow automate for code review? if you have idea, can you raise as PR proposal?
There was a problem hiding this comment.
It should be possible to evaluate the regex with dummy input and check if the captured indexes of string type matches the count of integer indexes + 1 (whole match).
There was a problem hiding this comment.
in such case, one has to provide this dummy input for each regex. i wonder if we can do it with static analysis without input data
fixes #9248
fixes #9249