noverify icon indicating copy to clipboard operation
noverify copied to clipboard

Linter doesn't inherit phpDoc types

Open rusjoan opened this issue 4 years ago • 0 comments

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 avatar Apr 13 '22 18:04 rusjoan