Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SlevomatCodingStandard.PHP.UselessParentheses not picking up on $var = (new ClassName()); #1686

Open
earthiverse opened this issue Jun 7, 2024 · 0 comments

Comments

@earthiverse
Copy link

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!?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant