spaze / phpstan-disallowed-calls

PHPStan rules to detect disallowed method & function calls, constant, namespace, attribute & superglobal usages
MIT License
263 stars 17 forks source link

`disallowedAttributes` (named) params can also be an array #190

Closed ruudk closed 1 year ago

ruudk commented 1 year ago

Otherwise it won't accept:

'disallowedAttributes' => [
            [
                'attribute' => Doctrine\ORM\Mapping\Entity::class,
                'message' => 'every entity requires a repository class.',
                'allowParamsAnywhereAnyValue' => [
                    [
                        'position' => 1,
                        'name' => 'repositoryClass',
                    ],
                ],
            ],
        ],
Invalid configuration:
The item 'parameters › disallowedAttributes › 0 › allowParamsAnywhereAnyValue › 0' expects to be string, array given.
Invalid configuration:
The item 'parameters › disallowedAttributes › 0 › allowParamsAnywhereAnyValue › 0' expects to be int|string|bool, array given.
spaze commented 1 year ago

Oh, that's #153 coming back once again :-( I'll think about if I can add some tests for this.

Sorry for that and thanks for the fix!