Inspectopedia
 
2024.3

Parentheses around the 'new' call can be omitted

Info
New
Last modified: 03 December 2024

Reports parentheses around the new expression in statements with class member access on instantiation, e.g. (new Foo)->bar(). In PHP 8.4 and later, such parentheses can be omitted.

See PHP RFC: new MyClass()->method() without parentheses for details.