vimeo/psalm

psalm doesn't work with aerospike extension

Open

#6,894 创建于 2021年11月11日

在 GitHub 查看
 (6 评论) (0 反应) (0 负责人)PHP (668 fork)batch import
Help wantedenhancement

仓库指标

Star
 (5,369 star)
PR 合并指标
 (平均合并 3天 12小时) (30 天内合并 5 个 PR)

描述

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?

贡献者指南