Skip to content

False positive for missing method param #2730

@nsrosenqvist

Description

@nsrosenqvist

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 #2264

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions