Skip to content
New issue

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

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

Already on GitHub? # to your account

Linter doesn't inherit phpDoc types #1174

Open
rusjoan opened this issue Apr 13, 2022 · 0 comments
Open

Linter doesn't inherit phpDoc types #1174

rusjoan opened this issue Apr 13, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@rusjoan
Copy link

rusjoan commented Apr 13, 2022

PHP Version: 7.4.28

OS: Debian Buster

Run command:

php-linter check --kphp --kphp7

The minimal code in which the bug appears:

Let's say we define an abstract class and extending class

abstract class A {
  /**
   * @param mixed[] $user
   */
  abstract public function foo(array $user);
}

class B {
  /**
   * @inheritDoc
   */
  public function foo(array $user) {
    ...
  }
}

Actual Behavior:

Linter says "Specify the type for the parameter $user in PHPDoc, 'array' type hint is too generic.

Expected Behavior:

I expect linter to inherit mixed[] type from base class method. This is how kphp actually work.

@rusjoan rusjoan added the bug Something isn't working label Apr 13, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant