Skip to content
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

[Debug] detect annotations before blank docblock lines #30437

Merged
merged 1 commit into from Mar 4, 2019

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Mar 4, 2019

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.

@@ -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)) {
Copy link
Member Author

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
*
Copy link
Member Author

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

Copy link
Contributor

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.

Copy link
Member

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"?

Copy link
Contributor

@fancyweb fancyweb Mar 4, 2019

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.

Copy link
Contributor

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?

Copy link
Member

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.

Copy link
Contributor

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 😄

Copy link
Member Author

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!

@xabbuh
Copy link
Member Author

xabbuh commented Mar 4, 2019

the failure is unrelated

@fabpot
Copy link
Member

fabpot commented Mar 4, 2019

Thank you @xabbuh.

@fabpot fabpot merged commit dedd526 into symfony:3.4 Mar 4, 2019
fabpot added a commit that referenced this pull request Mar 4, 2019
…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
@xabbuh xabbuh deleted the pr-29920 branch March 4, 2019 11:51
nicolas-grekas added a commit that referenced this pull request Mar 7, 2019
…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 was referenced Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants