Skip to content

Commit

Permalink
minor #476 [CS] Remove 'nullable_type_declaration_for_default_null_va…
Browse files Browse the repository at this point in the history
…lue' rule (smnandre)

This PR was merged into the 1.x branch.

Discussion
----------

[CS] Remove 'nullable_type_declaration_for_default_null_value' rule

Not too sure here with all the PHP versions to consider...

Using [nullable_type_declaration_for_default_null_value](https://cs.symfony.com/doc/rules/function_notation/nullable_type_declaration_for_default_null_value.html) rule with value `['use_nullable_type_declaration' => false]` is deprecated.

And, if i take the [Example 4](https://cs.symfony.com/doc/rules/function_notation/nullable_type_declaration_for_default_null_value.html#example-4), this rule enforces code that will trigger deprecation warning with PHP 8.4.. right ?

```diff
--- Original
+++ New
 <?php
-function sample(string|int|null $str = null)
+function sample(string|int $str = null)
 {}
```

I guess it's not so simple to revert the rule, so maybe a first step could be to remove the rule and avoid CI failures ?

Commits
-------

a315f9a Update .php-cs-fixer.dist.php
  • Loading branch information
nicolas-grekas committed Apr 12, 2024
2 parents 7aa8ce0 + a315f9a commit b09238d
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
'@Symfony:risky' => true,
'protected_to_private' => false,
'native_constant_invocation' => ['strict' => false],
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => false],
'no_superfluous_phpdoc_tags' => ['remove_inheritdoc' => true],
'header_comment' => ['header' => $fileHeaderComment],
])
Expand Down

0 comments on commit b09238d

Please sign in to comment.