staabm / phpstan-dba

PHPStan based SQL static analysis and type inference for the database access layer
https://staabm.github.io/archive.html#phpstan-dba
MIT License
250 stars 17 forks source link

DoctrineKeyValueStyleRule: properly handle unions #575

Closed hemberger closed 1 year ago

hemberger commented 1 year ago

If any of the arguments (table name or parameter values) to the DoctrineKeyValueStyleRule methods are a union type, each subtype will now be checked independently.

Previously, union types would cause an error, because of the improper use of instanceof *Type checks. This is now fixed by using methods to get the constants, e.g. getConstantStrings(), as recommended in https://github.com/staabm/phpstan-dba/pull/564#discussion_r1133053061.

staabm commented 1 year ago

thank you