PHP_CodeSniffer
PHP_CodeSniffer copied to clipboard
Expected type hint "MyClass[]"; found "array"
Example code:
/**
* Does foo with MyClass objects.
*
* @param MyClass[] $list List of objects.
*/
function foo( array $list ) {}
Expected result: This should be OK.
Actual result:
4 | ERROR | Expected type hint "MyClass[]"; found "array" for $list
Duplicate of #601.
Why was this closed? The comments in #601 clearly mentioned to create a new issue?
I have the same issue, PHPStan is happy this comments but this rule is conflicting. What should the advice be when we PHPCS and PHPStan?