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

question marks in comments are evaluated as query parameters

Open bloep opened this issue 2 years ago • 2 comments

$query = '
    Select * from ada
    where adakzid = 15 -- customer ???
';

$stmt = $pdo->prepare($query);
$query = $stmt->execute([]);

phpstan reports:

 ------ ------------------------------------------------------------------------ 
  Line   example.php
 ------ ------------------------------------------------------------------------
     7    Query expects 3 placeholders, but no values are given.
 ------ ------------------------------------------------------------------------

bloep avatar Aug 17 '22 11:08 bloep

I guess the same is true for named placeholders within comments.

think we should strip comments before placeholder analysis in the QueryReflection class

staabm avatar Sep 25 '22 18:09 staabm

hola,

@bloep could you see if https://github.com/staabm/phpstan-dba/pull/431 resolves your issue?

marmichalski avatar Oct 01 '22 11:10 marmichalski