format/types/nullable-for-null-default
In the format-laravel preset. Safe fix.
What it does
Adds or removes ? before single type declarations or |null at the end of union types when parameters have a default null value.
Configuration
[format.rules]
"types/nullable-for-null-default" = true
To skip it in some files, add a @pun-ignore-file comment.
Options
| Name | Type | Allowed values | Default | Upstream name |
|---|---|---|---|---|
use-nullable-type-declaration |
bool |
Any | true |
use_nullable_type_declaration |
Replaces
nullable_type_declaration_for_default_null_value(php-cs-fixer)ExplicitNullableParamType(rector)explicit-nullable-param(mago-linter)parameter.implicitlyNullable(phpstan)