format/operators/new-expression-parentheses
Not in any preset. Safe fix. Depends on [php] version.
What it does
All new expressions with a further call must (not) be wrapped in parentheses.
Why
new Foo()->bar() without parentheses is PHP 8.4 syntax, so when [php] version is below 8.4 the rule runs only with use-parentheses = true, which adds them.
Configuration
[format.rules]
"operators/new-expression-parentheses" = true
To skip it in some files, add a @pun-ignore-file comment.
Options
| Name | Type | Allowed values | Default | Upstream name |
|---|---|---|---|---|
use-parentheses |
bool |
Any | false |
use_parentheses |
Replaces
new_expression_parentheses(php-cs-fixer)NewMethodCallWithoutParentheses(rector)