-
-
Notifications
You must be signed in to change notification settings - Fork 190
[CodingStandard] sniff ideas #59
Comments
Might try fixer as well |
I think you check that one off now :)
out of curiosity, why do you not like this?
looking at the sample, a |
You're right, done!
It's not about not-liking fluent interfaces. They have their purpose and I'd use them in some places.
Yep, linter would do that. But it would require and extra tool to use in every place. Lazy people (me) won't use it. How would you put that into fixer? |
Thanks for the link to the blog of Marco, hadn't read this post before. I always like to read his blog even if I don't agree on all of it. . On the linting; if you've the PHP-CS-Fixer available you can use that one as linter as well. The fixer selects a linter (typically, you can use another when playing around with the configuration) based on the PHP executable found, it prefers one with tokenizing support otherwise it will fallback on the regular PHP executable using
The exit-code 4 is only used when using If you don't want to fix the code using the fixer for linting is a bit of an overkill of course, the more easy way would be to use PHP itself directly.
(PS:
keep on eye on PHP-CS-Fixer/PHP-CS-Fixer#2891 ;) ) |
Thanks for sharing link to "strict_types" location! 👍 Where exactly is that "linter" located in PHP-CS-Fixer? I need fixer class as I don't use CLI, but mostly only Fixer classes. |
The linter is not used in a fixer so that might make it more tricky to reuse in your case. |
I think I'll pass the linter now. I'm much more into more specific checkers. Thanks for clues anyway, they might be useful for me in the future. I came across this again and wonder... do you know any fixer doing this? Before$elements[] = ['file' => $path, 'label' => $name]; After$elements[] = [
'file' => $path,
'label' => $name
]; To make list arrays items exactly 1 per line. |
it was proposed here PHP-CS-Fixer/PHP-CS-Fixer#1217 |
Thanks, I'll check it |
Rest of more complex checkers moved to: https://github.com/TomasVotruba/Rector |
AST Refactors
Moved to Rector
sniffs teaching defensive programing - https://ocramius.github.io/extremely-defensive-php
refactor named service to typed service in Symfony
get container map
replace string by type
or by interface that implements
configurable
Finished Ideas
Use Entity
::class
over string name - suggested also here: Class keyword fixers PHP-CS-Fixer/PHP-CS-Fixer#1975, http://stackoverflow.com/questions/39154585/php-codesniffer-custom-rule-constant-class-instead-of-stringadd @Inject => __construct sniff" - done via [CodingStandard] fix multiple @inject properties for Refactor Sniff #236
Anti-shortcut naming sniff - resolved by https://github.com/object-calisthenics/phpcs-calisthenics-rules#6-do-not-abbreviate
No
Yea
uninitialized array/fake array definition sniff - [CodingStandard] add ArrayPropertyDefaultValueFixer #165
Detect Commented code
To check this:
complete interface implemetnation
it's forbidden to add public methods that are not in interfaces they implements
constant doc blocks
trait forbidden sniff - forbid creating traits
classes extendin TestCase are final, or any class listed
controller/presenter has exactly 1 method
Outsourced
<?php declare...
, https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/2891/filesThe text was updated successfully, but these errors were encountered: