Skip to content

PHPStan: Conflicting standards for array return types #21

@Mirroar

Description

@Mirroar

When using php-code-validator together with PHPStan on a project, there is no way to satisfy both tools. When using return type array in a doc block, PHPStan gives the following error:

Method Foo\AuthMiddlewareTest::dataProviderTestProcess() return type has no value type specified in iterable type array.  
💡 See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type

Fixing this in a way that satisfies PHPStan then causes php-code-validator to throw an error along the lines of

Return type "array<string>" is discouraged

Disabling the rule in PHPStan would be an option, but at the cost of statistical analysis accuracy.

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