-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Remove uneeded docblocks #25859
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
Remove uneeded docblocks #25859
Conversation
@fabpot I just pushed fix for intertag blank lines in Symplify v3.2.4 Let me know if any more use cases fail |
7f455f4
to
53784ee
Compare
* | ||
* @throws \InvalidArgumentException | ||
* @throws InvalidArgumentException |
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.
@TomasVotruba Not sure why it removed the blackshash here.
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.
Unfortunately, this is also default behavior of ReflectionDocBlock. I'll look on that.
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.
Fixed: deprecated-packages/symplify#602
Please try v3.2.5
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.
@TomasVotruba Running the new version give me this error:
Fixing of "src/Symfony/Component/HttpFoundation/Request.php" file by "Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDocBlockFixer" failed: Unknown modifier 'c' in pattern: #@see[\s]+(?<has_
slash>\\)?https\://tools\.ietf\.org/html/rfc7231#section\-4\.2\.1# in file /Users/fabien/Code/github/Symplify/EasyCodingStandard/vendor/nette/utils/src/Utils/Strings.php on line 604
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.
Fixed in v3.2.6 and run on symfony/symfony 2.7 myself with success
Here is preview PR: 2.7...TomasVotruba:phpdocs-removal
with this ECS setup:
# ecs.neon
checkers:
- PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer
- Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDocBlockFixer
# remove extra blank lines caused by previous fixer
- Symplify\CodingStandard\Fixer\Commenting\RemoveEmptyDocBlockFixer
- Symplify\CodingStandard\Fixer\Commenting\RemoveSuperfluousDocBlockWhitespaceFixer
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 see there are few edge case. I'll try to fix some, but some are very difficult to catch with provided ReflectionDocBlock api. I'd have to write my own package to be able to resolve it correctly :)
it also broke phdoc alignments |
@ostrolucky That's responsibility of another fixer. |
Right. But there might be issue with set priorities. Anyway I'm not blaming your fixer, but pointing to an issue in this PR. |
I see. I think @fabpot didn't run it with the other fixer. @fabpot I recommend running this first, than "@symfony" set from PHP CS Fixer, that's how I use it in practise just in one ECS run. That would prevent any other fails that are covered by fixers. @ostrolucky The |
53784ee
to
3f375af
Compare
@@ -210,7 +209,6 @@ private function dumpItem($dumper, $cursor, &$refs, $item) | |||
* | |||
* @param DumperInterface $dumper | |||
* @param Cursor $parentCursor The cursor of the parent hash | |||
* @param array &$refs A map of all references discovered while dumping |
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.
@TomasVotruba Checking the diff, I think the current strategy is too aggressive. Here is one such example where the comment seems interesting and should probably be kept. WDYT?
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.
@fabpot Thanks for comment. I've noticed this already. I think it's caused by &
which probably leads parsing error and to empty comment.
I'm adding it to the cases to be fixed.
This PR is now ready to be reviewed. I've added a comment on one example where the comment should probably be kept instead of removed (as the description adds some value). |
There is 1 last issue reported in fabpot.io: https://fabbot.io/report/symfony/symfony/25859/3f375af281292adbdffb83ae5a6860bc45b393ea What fixer takes care of that? I'll add it to my comment to complete the setup |
@@ -144,8 +143,7 @@ protected function renderTable(Table $table, $decorated = false) | |||
* Common options are: | |||
* * name: name of described service | |||
* | |||
* @param Definition|Alias|object $service | |||
* @param array $options | |||
* @param Definition|\Alias|object $service |
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.
prepending \
to Alias
is wrong
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.
* @param callable|null $callback A PHP callback to run whenever there is some | ||
* output available on STDOUT or STDERR | ||
* @param int $verbosity The threshold for verbosity | ||
* @param string|array|\Process $cmd An instance of Process or an array of arguments to escape and run or a command to run |
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.
wrong \
on Process
, class is correctly imported
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.
@@ -80,8 +79,7 @@ public function run(OutputInterface $output, $cmd, $error = null, $callback = nu | |||
* This is identical to run() except that an exception is thrown if the process | |||
* exits with a non-zero exit code. | |||
* | |||
* @param OutputInterface $output An OutputInterface instance | |||
* @param string|Process $cmd An instance of Process or a command to run | |||
* @param string|\Process $cmd An instance of Process or a command to run |
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.
same
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.
Fixed
* @param int|string|FormInterface $child | ||
* @param null $type | ||
* @param array $options | ||
* @param int|string|\FormInterface $child |
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.
wrong \
, I stop here :) the fixer seems to consider that classes are all coming from the global namespace
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.
@TomasVotruba Can you have a look at this issue?
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.
Fixed allong with &$value
references.
I discovered one more error to resolve
Last version to check: master...TomasVotruba:phpdos-removal-master If you comment there, I'll try to fix that asap. Don't mind the indent, just docs removal. Used set: # easy-coding-standard
checkers:
- Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDocBlockFixer
- PhpCsFixer\Fixer\Phpdoc\PhpdocIndentFixer
- PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer
# works best with these checkers, to remove empty docblock
- Symplify\CodingStandard\Fixer\Commenting\RemoveSuperfluousDocBlockWhitespaceFixer
- Symplify\CodingStandard\Fixer\Commenting\RemoveEmptyDocBlockFixer |
@TomasVotruba Some annotations are replaced by an extra blank line, sometimes an extra blank line is just added between the phpdoc description and the first |
@chalasr Oh, I only used the remover fixer. But I've added space cleaner as well and updated the code. Ready for review 👍 |
I've just updated this PR with the new code (thanks @TomasVotruba) |
3f375af
to
abc13dc
Compare
* * Each tag is converted to a key value or an array | ||
* if there is more than one "value" | ||
* * Each tag is converted to a key value or an array | ||
* if there is more than one "value" |
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.
Not sure about this change. The space is needed to render proper Markdown.
* Use \Symfony\Component\DependencyInjection\ContainerBuilder::addExpressionLanguageProvider instead. | ||
* | ||
* @param ExpressionFunctionProviderInterface $provider | ||
* Use \Symfony\Component\DependencyInjection\ContainerBuilder::addExpressionLanguageProvider 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.
I think the previous version is more readable and as it renders the same, I would not change 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.
This is something I can't cover easily. I recommend reverting those manually.
* @param \Traversable $iterator | ||
* $a and $b such that $a goes before $b in $expected, the method | ||
* asserts that any element of $a goes before any element of $b | ||
* in the sequence generated by $iterator |
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.
And here, I'm pretty sure that the indentation is wrong as this describes the $expected
param.
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 is something I can't cover easily. I recommend reverting those manually.
@@ -1479,8 +1477,6 @@ public function isMethod($method) | |||
* | |||
* @see https://tools.ietf.org/html/rfc7231#section-4.2.1 | |||
* | |||
* @param bool $andCacheable Adds the additional condition that the method should be cacheable. True by default. |
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 one should not be removed.
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'll look on this one
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.
Oh, I see it's commented bellow. This Fixer is not able to differentiate between commented argument and extra useless docs for param.
Just revert this manually
@@ -47,8 +47,6 @@ public function all() | |||
|
|||
/** | |||
* Adds a route or collection. | |||
* | |||
* @param DumperRoute|DumperCollection The route or collection |
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.
Cannot be removed, I think it was removed as it's not valid. $child
is missing here.
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.
Yes, this is better to fix manually, since this Fixer relies on valid code.
@TomasVotruba Have you had time to have a look at the issues I've noticed here? |
@fabpot I missed your comments here, sorry. I'm looking into it. |
@TomasVotruba would you like to take over doing the manual tweaks? Otherwise I'd suggest to close. |
@nicolas-grekas Sure. I can get to in till Friday. |
@nicolas-grekas I'll try to re-send this. Which branch should I target now? |
3.4 is the oldest maintained branch now. |
Big cleanup (replaces #24931).
Thanks @TomasVotruba for doing all the hard work :)
Before merging, blanck lines between
@param
blocks and@throws
/@return
/ ... should be kept.