Skip to content

False positive for variable parameter hints #683

@CodeDuck42

Description

@CodeDuck42

The PHPDoc tag of foo[] should equal array<int, foo> and not array<foo>

 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ----------------------------------------------------------------------------------------------------------
  Line   baz.php
 ------ ----------------------------------------------------------------------------------------------------------
  10     PHPDoc tag @param for parameter $foos with type array<foo> is not subtype of native type array<int, foo>
 ------ ----------------------------------------------------------------------------------------------------------


 [ERROR] Found 1 error

foo.php

<?php

class foo
{
    public function bar(): void
    {
    }
}

baz.php

<?php

require_once __DIR__ . '/foo.php';

class baz
{
    /**
     * @param foo[] $foos
     */
    public function test(foo ...$foos): void
    {
        // ...
    }
}

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