-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: FQCN parse phpdoc using full grammar regex #7649
fix: FQCN parse phpdoc using full grammar regex #7649
Conversation
c2a28ab
to
2b3e237
Compare
6f4a670
to
659c19e
Compare
792e224
to
b87fabc
Compare
cd5d1fa
to
bbd8bc9
Compare
5844908
to
b21f564
Compare
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 found a few minutes to look at this, here's some minor doubts 🙂.
@mvorisek this PR does not provide support for multiline phpDoc types, right? Is it actually possible to handle them with the regex approach, since |
2x right |
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.
👍 from me, but we need to wait for @keradus to verify whether his doubts were addressed properly.
999bff8
to
df78046
Compare
@@ -586,7 +586,7 @@ function validate(): void {} | |||
*/ | |||
function validate(): void {} | |||
', | |||
['import_symbols' => true], | |||
['import_symbols' => true, 'phpdoc_tags' => ['link']], |
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 would be wondering why link
is not there by default, but probably other discussion :D
yield 'PHPDoc with generics must not crash' => [ | ||
'<?php | ||
|
||
/** | ||
* @param \Iterator<mixed, \SplFileInfo> $iter | ||
*/ | ||
function foo($iter) {}', | ||
]; | ||
|
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.
side note:
with recently introduced "test class is contract", while adding support for generics, you would need to put it behind rule option, as otherwise it would change contract behaviour.
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.
looking good!
@mvorisek if great work of yours are not getting attention for longer period, please do not hesitate to poke on us, but you may give us more time than one day before pushing 😅 |
This PR fixes all issues with partly parsed phpdoc type.
in short, it matches the type correctly using full grammar regex and then the parsed match is tested if it is a simple type: