-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Debug] detect annotations before blank docblock lines #30437
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
Conversation
@@ -233,7 +233,7 @@ public function checkAnnotations(\ReflectionClass $refl, $class) | |||
// Detect annotations on the class | |||
if (false !== $doc = $refl->getDocComment()) { | |||
foreach (['final', 'deprecated', 'internal'] as $annotation) { | |||
if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) { | |||
if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) { |
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.
detects blank lines after @final
/@deprecated
/@internal
annotations (detected by the fixtures update made in df1d50d)
@@ -64,7 +64,6 @@ class FinalClass6 | |||
* @author John Doe | |||
* | |||
* @final another | |||
* |
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.
this change had to be reverted as otherwise the second line is not part of the multiline comment
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'm sorry but isn't it a BC to alter a test case? Those cases were made on purpose. If they don't fit SF CS standard, we better exclude them from the analysis.
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.
BC breaks relate to the interface, here it's a behavior change :) - considered a bug fix.
If you don't agree, can you find some kind of "proof" that blank lines in multi line comments are "legal"?
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'm thinking of the case where you use the component outside of SF framework ofc.
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.
Sorry @nicolas-grekas, wrote my last message without seeing yours. I don't have any proof. Just that if we can support more cases, why wouldn't we do it? I tried to support as many cases as possible when I did this so let's keep it that way and ignore those fixtures files in CS checks instead?
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.
It's not related to Symfony. If phpdocs do not support a blank line in multiline comments, we must not support it either.
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.
The problem with PHPDoc is that it's not clear at all on edge cases... Since I didn't find an example on the website that have a multiline comment with a blank line, I guess you are right. We can keep it like this 😄
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.
Thank you for the feedback @fancyweb!
the failure is unrelated |
Thank you @xabbuh. |
…bbuh) This PR was merged into the 3.4 branch. Discussion ---------- [Debug] detect annotations before blank docblock lines | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | This fixes the tests and a small issue after the CS changes made in df1d50d for #29920. Commits ------- dedd526 detect annotations before blank docblock lines
…k docblock lines on final and internal methods (fancyweb) This PR was merged into the 3.4 branch. Discussion ---------- [Debug][DebugClassLoader] Detect annotations before blank docblock lines on final and internal methods | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - @xabbuh Follow up of #30437 Commits ------- e97ea77 [Debug][DebugClassLoader] Detect annotations before blank docblock lines on final and internal methods
This fixes the tests and a small issue after the CS changes made in df1d50d for #29920.