-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[cs] remove unused doc blocks #24931
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
@@ -198,7 +198,7 @@ public function __construct(A $a, $foo = 'default_val', Lille $lille) | |||
} | |||
} | |||
|
|||
/* | |||
/** | |||
* Classes used for testing createResourceForClass | |||
*/ | |||
class ClassForResource |
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.
These docs were incorrectly interpretted by PHP CS Fixer as single line, thus fixing them to Doc Blocks
Even if I'd love to remove all PHPdocs from all files ... I find it strange to keep some |
Some have added value, some don't and only duplicate information. |
What you did is correct, but let me explain the problem I see (using as an example the first change you did): Original /**
* Adds the stack logger for a connection.
*
* @param string $name
* @param DebugStack $logger
*/
public function addLogger($name, DebugStack $logger) Proposed solution /**
* Adds the stack logger for a connection.
*
* @param string $name
*/
public function addLogger($name, DebugStack $logger) Best solutionpublic function addLogger(string $name, DebugStack $logger) We can't make the best solution to avoid BC issues, but the problem I see with the proposed solution is that people will think we made a mistake and forgot to add the |
Yeah, I think partial phpdoc is confusing for users. We should keep an all-or-nothing approach for the parameter list IMO |
I see what you mean. Is there any reason to have it such way apart historical reasons? I realize there were not such tools in the past, but today thanks to coding standard tools this is now easy to configure and improve. It will make code much easier to read for users and easier modify in the future. Moving to Best solution as next step. Merged Use CaseSimilar PRs were merged to See especially these cases: https://github.com/php-ai/php-ml/pull/145/files#diff-1359851beb8da185b9d9adae86ab2ff7 |
This will not happen if fabbot generates the patch, because then, it will become an enforced policy. |
* @param ObjectManager $manager | ||
* @param mixed $queryBuilder | ||
* @param string $class | ||
* @param mixed $queryBuilder |
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.
mixed params could be removed as well as mixed
does not give any useful information.
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'd rather keep this, since mixed
type is comming to PHP and it would make easier transition to scalar type, as in string
, int
etc. before
@TomasVotruba Can you also change the base to 2.7? Thanks. Are you doing this by hand? Or with a tool? If you are using a tool/regexes/..., can you share it so that merging up to master will be easier? |
@fabpot Here is all you asked for: https://www.tomasvotruba.cz/blog/2017/12/17/new-in-symplify-3-doc-block-cleaner-fixer/ Shall I run this rule on 2.7 with current setup then? |
@TomasVotruba Can you share you setup? Such PRs are complex to merge as merging it to newest branches is a mess. So, if you can share you setup, I will be able to run it on all branches, limiting the time it takes to merge the change up. Thanks. |
@fabpot Sure, I use exactly this setup: https://www.tomasvotruba.cz/blog/2017/12/17/new-in-symplify-3-doc-block-cleaner-fixer/#challenge-your-code |
@TomasVotruba I've just tried by it fixes only 15 files. |
@fabpot I'm not aware of any major change that could cause this. And version? Last is 3.1 |
I've tried on master and v3.2.2, which looks like the last one (from a git clone https://github.com/Symplify/EasyCodingStandard) |
@fabpot I meant 3.2, yes. |
I tried it like this: git clone github.com/symfony/symfony
cd ../symplify # monorepo, with 3.2.3 version (I fixed one variadics bug and just released patch version)
packages/EasyCodingStandard/bin/ecs check ../symfony/src/Symfony --clear-cache --config cleaning-symfony.neon Where # cleaning-symfony.neon
checkers:
- Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDocBlockFixer With this result: Then with |
I think I forgot to pass the config file. Now it looks much better, but I get this error:
Note that I got the config from your blog post. |
Also, I noticed that it removes the blank line between |
That's what I fixed. Do you have version 3.2.3?
Use the one provided here, just to be sure the main fixer works for you. The other 2 are just space fixers.
I thinks so. Will create issue for that. It uses |
Ok, I forgot to run |
See #25859 for the current state. |
Follow-up to #24930