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

minor: Let PhpdocLineSpan fixer detect docblocks when seperator from token with attribute #6343

Merged

Conversation

bobvandevijver
Copy link
Contributor

This fix allows the phpdoc_line_span fixer to detect attributes between a docblock and the token it is working on.

It now updates (depending on the configuration)

/**
 * @return void
 */
#[Attribute1, Attribute2]
public function hello() {}

to

/** @return void */
#[Attribute1, Attribute2]
public function hello() {}

while it did not touch this structure before.

@SpacePossum
Copy link
Contributor

Thanks for the PR! and sorry for the long wait.

I left a little minor, but with or without it applied I think this PR RTM

@SpacePossum
Copy link
Contributor

SpacePossum commented Jul 20, 2022

thanks for the changes @bobvandevijver 👍

@julienfalque can you allow the workflow to run? thanks!

@coveralls
Copy link

coveralls commented Jul 21, 2022

Coverage Status

Coverage increased (+0.002%) to 92.905% when pulling e73fb9a on bobvandevijver:phpdoc_line_span_attributes into 40716fc on FriendsOfPHP:master.

@bobvandevijver
Copy link
Contributor Author

Maybe a rebase would help to fix the static analysis?

@julienfalque
Copy link
Member

It should be fixed by #6506.

@julienfalque julienfalque changed the title Phpdoc line span attributes minor: Phpdoc line span attributes Jul 21, 2022
@bobvandevijver
Copy link
Contributor Author

Looks like phpstan is finding 13 errors, but they are all in other files...

@SpacePossum
Copy link
Contributor

yeah I think what it really wants is some type docs on the newly created dataprovider, but not 100% sure, maybe Julien has an idea on this one :)

thanks for change from \Generator to iterable 👍

@julienfalque
Copy link
Member

Yep, I think the reported error is the last that matches the ignore regexp, not necessarily the one that is added by your changes.

@bobvandevijver
Copy link
Contributor Author

@julienfalque I actually had mixed first, but changed it back to string as that was more commonly used in the other tests 😅

@julienfalque
Copy link
Member

I think mixed is best suited because we can't be sure options will always be string. Anyway, not very important since data providers are not checked against test parameters.

@julienfalque julienfalque changed the title minor: Phpdoc line span attributes minor: Let PhpdocLineSpan fixer detect docblocks when seperator from token with attribute Jul 22, 2022
@julienfalque julienfalque merged commit 2389f5c into PHP-CS-Fixer:master Jul 22, 2022
@julienfalque
Copy link
Member

Thank you @bobvandevijver.

@bobvandevijver bobvandevijver deleted the phpdoc_line_span_attributes branch July 22, 2022 08:03
@SpacePossum
Copy link
Contributor

thanks @bobvandevijver , nice one :)

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

4 participants