phpstan-doctrine
phpstan-doctrine copied to clipboard
Idea: Check if QueryBuilder `->where()->setParameter()` is set to `Types::SIMPLE_ARRAY` for array columns
When a field is defined as simple_array:
#[ORM\Column(type: Types::SIMPLE_ARRAY, length: 255, nullable: true)]
private array $foo = [];
... then using it in a Query Builder like this
$queryBuilder->where('a.foo = :array')->setParameter('array', $array, Types::SIMPLE_ARRAY);
... only works, if the third argument to setParameter() ($type) is given.
If not, I'm getting this Doctrine\DBAL\Exception\ SyntaxErrorException:
An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 near ",": syntax error
Would it possible for PHPStan to check for this?