Hi,
Mostly opening this issue to document it if someone else encounter it. The warnings are not caused by Psalm itself but by one of its dependency: phpmyadmin/sql-parser.
The PHP warnings can be reproduced with the following minimal code snippet:
<?php
'SELECT a CASE';
Output:
PHP Warning: count(): Parameter must be an array or an object that implements Countable in vendor/phpmyadmin/sql-parser/src/Components/CaseExpression.php on line 296
Warning: count(): Parameter must be an array or an object that implements Countable in vendor/phpmyadmin/sql-parser/src/Components/CaseExpression.php on line 296
PHP Warning: count(): Parameter must be an array or an object that implements Countable in vendor/phpmyadmin/sql-parser/src/Components/CaseExpression.php on line 297
Warning: count(): Parameter must be an array or an object that implements Countable in vendor/phpmyadmin/sql-parser/src/Components/CaseExpression.php on line 297
A PR has been proposed upstream to fix this: phpmyadmin/sql-parser#241
Thanks for PRing that!
Related to https://github.com/vimeo/psalm/issues/768#issuecomment-477694249 , which had some other questions
Making the sql detection possible to disable would help work around future issues
Making the sql detection possible to disable would help work around future issues
Yeah, alternatively I disable this and make some sort of plugin hook for it
Hi,
On a personal note, I would not be against having the SQL detection has a feature that can be enabled/disabled when needed as it generates a non negligible increase of the memory usage on my codebase.
With the SQL detection/parsing, cache disabled, and Psalm 3.2.8:
Checks took 312.30 seconds and used 2,629.124MB of memory
Without the SQL detection/parsing, cache disabled, and Psalm 3.2.8:
Checks took 296.59 seconds and used 742.611MB of memory
I've disabled it by default, and added parseSql and maxStringLength config flags.
Most helpful comment
I've disabled it by default, and added
parseSqlandmaxStringLengthconfig flags.