vimeo/psalm

psalm doesn't work with aerospike extension

Open

#6894 aperta il 11 nov 2021

Vedi su GitHub
 (6 commenti) (0 reazioni) (0 assegnatari)PHP (668 fork)batch import
Help wantedenhancement

Metriche repository

Star
 (5369 star)
Metriche merge PR
 (Merge medio 3g 12h) (5 PR mergiate in 30 g)

Descrizione

if PHP has an aerospike extension, psalm fails with this stacktrace:

Uncaught TypeError: Argument 1 passed to Psalm\Storage\FunctionLikeParameter::__construct() must be of the type string, null given, called in /home/maxm/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Reflection.php on line 333 and defined in /home/maxm/psalm/vendor/vimeo/psalm/src/Psalm/Storage/FunctionLikeParameter.php:115
Stack trace:
#0 /home/maxm/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Reflection.php(333): Psalm\Storage\FunctionLikeParameter->__construct(NULL, false, Object(Psalm\Type\Union), NULL, NULL, false, false, false)
#1 /home/maxm/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Reflection.php(301): Psalm\Internal\Codebase\Reflection->getReflectionParamData(Object(ReflectionParameter))
#2 /home/maxm/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Reflection.php(197): Psalm\Internal\Codebase\Reflection->extractReflectionMethodInfo(Object(ReflectionMethod))
#3 /home/maxm/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(511): Psalm\Internal\Codebase\Reflection->registerClass(Object(ReflectionClass))
#4 /home/maxm/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(298): Psalm\Internal\Codebase\Scanner->convertClassesToFilePaths(Object(Psalm\Internal\Codebase\ClassLikes))
#5 /home/maxm/psalm/vendor/vimeo/psalm/src/Psalm/Config.php(2098): Psalm\Internal\Codebase\Scanner->scanFiles(Object(Psalm\Internal\Codebase\ClassLikes))
#6 /home/maxm/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(405): Psalm\Config->visitComposerAutoloadFiles(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), Object(Psalm\Progress\VoidProgress))
#7 /home/maxm/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(1150): Psalm\Internal\Analyzer\ProjectAnalyzer->visitAutoloadFiles()
#8 /home/maxm/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(362): Psalm\Internal\Analyzer\ProjectAnalyzer->checkPaths(Array)
#9 /home/maxm/psalm/vendor/vimeo/psalm/psalm(4): Psalm\Internal\Cli\Psalm::run(Array)

It happens probably because aerospike extension doesn't provide parameters names for the implemented methods ( see details in comments https://github.com/aerospike/aerospike-client-php/issues/30 )

Any chance to fix it on the psalm side as aerospike authors seem reluctant to fix it on their side? Or maybe you have any ideas for a workaround?

Guida contributor