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

feat: NoEmptyPhpdocFixer - do not leave empty line after removing PHPDoc #7820

Merged

Conversation

kubawerlos
Copy link
Contributor

NoEmptyPhpdocFixer (priority 3) should run before ClassAttributesSeparationFixer priority 55) - proof:

echo '<?php
class Foo
{
    public function f1() {}

    /**
     */
    public function f1() {}
}' > test.php

php php-cs-fixer fix --diff -vvv test.php --rules='{"class_attributes_separation":{"elements":{"method":"one"}}, "no_empty_phpdoc": true}'
php php-cs-fixer fix --diff -vvv test.php --rules='{"class_attributes_separation":{"elements":{"method":"one"}}, "no_empty_phpdoc": true}'
rm test.php

But it can't:

  • ClassAttributesSeparationFixer must run before IndentationTypeFixer
  • IndentationTypeFixer must run before PhpdocIndentFixer
  • PhpdocIndentFixer must run before NoEmptyPhpdocFixer
    (probably not the only blocker)

So, let's remove the line when removing PHPDoc (if possible).

Ref. #3604

@coveralls
Copy link

coveralls commented Feb 5, 2024

Coverage Status

coverage: 94.774% (+0.002%) from 94.772%
when pulling 3f451c7 on 6b7562617765726c6f73:feat_NoEmptyPhpdocFixer
into 13df1fc on PHP-CS-Fixer:master.

@Wirone Wirone enabled auto-merge (squash) February 8, 2024 08:58
@Wirone Wirone added the topic/phpdoc PHPDoc tags, Doctrine Annotations etc. label Feb 8, 2024
@Wirone Wirone merged commit e383c84 into PHP-CS-Fixer:master Feb 8, 2024
25 checks passed
@Wirone Wirone deleted the feat_NoEmptyPhpdocFixer branch February 8, 2024 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/phpdoc PHPDoc tags, Doctrine Annotations etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants