Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

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

More format/operators rules · Edit this page

Last updated on

Was this page helpful?