-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Methods/constants with name empty/isset/unset are always reported as error #3609
Comments
I noticed that too. Nothing can be done |
Same. // @codingStandardsIgnoreStart
public function empty()
{
// @codingStandardsIgnoreEnd As a temporary workaround. |
This actually is a problem for more function names: <?php
declare(strict_types=1);
final class Test
{
public function unset()
{
return;
}
public function empty()
{
return;
}
public function isset()
{
return;
}
}
|
Thank you all for reporting this. PR #3610 should fix it. Testing appreciated! |
gsherwood
added a commit
that referenced
this issue
Jun 13, 2022
This was referenced Jun 13, 2022
gsherwood
changed the title
Method with name
Methods/constants with name empty/isset/unset are always reported as error
Jun 13, 2022
empty
is always reported as error
gsherwood
added a commit
that referenced
this issue
Jun 13, 2022
This was referenced Jun 14, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
PHPCS considers methods with name
empty
to be incorrectCode sample
Custom ruleset
No custom rules. Just PSR12 standard
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs --standard=PSR12 test.php
If you change method name to basically anything else -
empty1
,createEmpty
etc - there is no errorExpected behavior
No complains.
Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: