coding-standard
coding-standard copied to clipboard
`SlevomatCodingStandard.PHP.UselessParentheses` not picking up on `$var = (new ClassName());`
Essentially what I wrote in the title.
I added the SlevomatCodingStandard.PHP.UselessParentheses sniff to try to pick up on these useless parentheses from a recent code review:
$remoteAddress = (new RemoteAddress());
but it never detected it. It did detect a lot of other useless parentheses, though :)
Of course, if I did something like this:
$ip = (new RemoteAddress())->getIpAddress();
I expect the sniff not to report as useless (but PHP 8.4 might allow no parentheses around new objects!?)