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

Can't use empty, isset, unset as method names #3614

Closed
pchapl opened this issue Jun 15, 2022 · 2 comments
Closed

Can't use empty, isset, unset as method names #3614

pchapl opened this issue Jun 15, 2022 · 2 comments

Comments

@pchapl
Copy link

pchapl commented Jun 15, 2022

Describe the bug
When empty (or isset, unset) is used as method name, phpcs doesn't recognize it and produce weird error messages

Code sample

<?php

declare(strict_types=1);

namespace App;

abstract class Temp
{
    abstract public function empty(): void;
    abstract public function isset(): void;
    abstract public function unset(): Temp; // <- another error for CamelCased return type
}

To reproduce

  1. Create a file called Temp.php with the code sample above...
  2. Run phpcs Temp.php ...
  3. See error message displayed
FILE: Temp.php
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
  9 | ERROR | Expected "function abc(...)"; found "function abc(...)"
 10 | ERROR | Expected "function abc(...)"; found "function abc(...)"
 11 | ERROR | Method name "Temp::Temp" is not in camel caps format
 11 | ERROR | Expected "function abc(...)"; found "function abc(...)"
----------------------------------------------------------------------

Expected behavior
No errors OR message about inappropriate method name

Versions (please complete the following information):

  • OS: Linux 5.17.12-200.fc35.x86_64
  • PHP: 8.1.7
  • PHPCS: 3.7.0
  • Standard: PSR12
@jrfnl
Copy link
Contributor

jrfnl commented Jun 15, 2022

Seriously ? Duplicate of #3609 (and #3611 and #3612 and #3613), which has already been fixed via #3610.

@pchapl pchapl closed this as completed Jun 15, 2022
@pchapl
Copy link
Author

pchapl commented Jun 15, 2022

My bad: didn't realize that default search condition includes open issues only. Sorry!

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

2 participants