phpactor icon indicating copy to clipboard operation
phpactor copied to clipboard

False positive for missing method param

Open nsrosenqvist opened this issue 5 months ago • 5 comments

This code snippet here results in Method "array" is missing @param $input even though it is specified in the PHPDoc. It likely has something to do with the definition syntax that PHPStan supports.

declare(strict_types=1);

namespace App;

class Asd
{
    /**
     * @param array{0: 'w', 1: 'o', 2: 'r', 3: 'l', 4: 'd'} $input
     *
     * @return 'world'
     */
    public function hello(array $input): string
    {
        return implode('', $input);
    }
}

Possibly related to https://github.com/phpactor/phpactor/issues/2264

nsrosenqvist avatar Sep 02 '24 10:09 nsrosenqvist