sonata-project / dev-kit

Development kit of the Sonata-Project
https://master-7rqtwti-ptm4dx6rjpjko.eu-5.platformsh.site/
42 stars 42 forks source link

Avoid superfluous parentheses (php-cs-fixer) #1362

Closed vv12131415 closed 3 years ago

vv12131415 commented 3 years ago

During review in https://github.com/sonata-project/SonataAdminBundle/pull/6778#discussion_r561338984 @phansys came to idea to avoid superfluous parentheses in conditional branches. The example of this is

if (!($collection instanceof Collection)) {

which should be fixed to

if (!$collection instanceof Collection) {
OskarStark commented 3 years ago

Can you provide a PR against dev-kit repo? Search for .php_cs.dist.twig file

Thanks

I am currently on a phone 📱

vv12131415 commented 3 years ago

I haven't found the right rule here https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/2.18/doc/rules/index.rst

phansys commented 3 years ago

See no_unneeded_control_parentheses.

VincentLanglet commented 3 years ago

See no_unneeded_control_parentheses.

Already provided by the Symfony ruleset. The rules you look for is a feature-request: https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4997.

So I'm closing the issue.