vimeo/psalm

psalm doesn't work with aerospike extension

Open

#6,894 opened on Nov 11, 2021

View on GitHub
 (6 comments) (0 reactions) (0 assignees)PHP (668 forks)batch import
Help wantedenhancement

Repository metrics

Stars
 (5,369 stars)
PR merge metrics
 (Avg merge 3d 12h) (5 merged PRs in 30d)

Description

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?

Contributor guide