phpstan-doctrine icon indicating copy to clipboard operation
phpstan-doctrine copied to clipboard

[reproducer] QueryBuilder DQL is not reported correctly when QB is pased around

Open mhujer opened this issue 6 years ago • 0 comments

This is not a bugfix but rather just a bug-reproducer.

I stumbled across this when testing a class that add extra conditions to a provided Query Builder.

Strict comparison using === between 'SELECT e FROM…' and 'SELECT e FROM…' will always evaluate to false.

When there is a QB passed around and where() or something is called in the other method (or class), the resulting DQL is not reported correctly. I understand that it is hard to statically analyze code like this when the things happen in separate methods. The solution may be not to analyze the DQL query builder in this case (or just mark it as a string, not as a "fixed" string).

Also the error message is not very helpful because the displayed portion is similar, in this case it should probably display whole DQL.

I am not sure where this should be fixed but I will try to fix, if you point me in the correct direction.

mhujer avatar Oct 10 '19 10:10 mhujer