Skip to content

DX: update Symfony rule set#6958

Merged
Wirone merged 2 commits intoPHP-CS-Fixer:masterfrom
werlos:update_symfony_rule_set
May 19, 2023
Merged

DX: update Symfony rule set#6958
Wirone merged 2 commits intoPHP-CS-Fixer:masterfrom
werlos:update_symfony_rule_set

Conversation

@kubawerlos
Copy link
Copy Markdown
Member

All these (obviously except header_comment) shouldn't need to be added separately, but be in @Symfony and @Symfony:risky sets already.

Copy link
Copy Markdown
Member

@Wirone Wirone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again: shouldn't dist config be changed? 😅

@kubawerlos
Copy link
Copy Markdown
Member Author

Again: shouldn't dist config be changed? sweat_smile

Reading the comment in the dist confing probably better would be to disable modernize_strpos for @PhpCsFixer:risky (until we stop supporting PHP < 8).

@kubawerlos kubawerlos requested a review from Wirone May 18, 2023 22:01
@Wirone Wirone merged commit 3ce71b0 into PHP-CS-Fixer:master May 19, 2023
@Wirone
Copy link
Copy Markdown
Member

Wirone commented May 19, 2023

Thanks @kubawerlos 🍻

@darkin1
Copy link
Copy Markdown

darkin1 commented May 31, 2023

In terms of change use_nullable_type_declaration default, I just wanted to mention using implicit type rather than explicit seems to not be recommended by PHP

As of PHP 8.0.0, declaring mandatory arguments after optional arguments is deprecated. This can generally be resolved by dropping the default value, since it will never be used. One exception to this rule are arguments of the form Type $param = null, where the null default makes the type implicitly nullable. This usage remains allowed, though it is recommended to use an explicit nullable type instead.

https://www.php.net/manual/en/functions.arguments.php

https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.nullable

@kubawerlos
Copy link
Copy Markdown
Member Author

@darkin1 the part:

using implicit type rather than explicit seems to not be recommended

for me applies to pretty much everything, it was added not because it is good practice, but because it is in current Symofny's standards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants