We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Despite #6989 and #7196, it seems the first class callables are still causing some crashes. Here is a simple example (https://psalm.dev/r/2cfb6f69bb)
<?php call_user_func(array_map(...), intval(...), ['1']);
D:\Projects\psalm-bug λ vendor\bin\psalm Target PHP version: 8.1 (inferred from current PHP version) Scanning files... Uncaught AssertionError: assert(!$this->isFirstClassCallable()) in D:\Projects\psalm-bug\vendor\nikic\php-parser\lib\PhpParser\Node\Expr\CallLike.php:36 Stack trace: #0 D:\Projects\psalm-bug\vendor\nikic\php-parser\lib\PhpParser\Node\Expr\CallLike.php(36): assert(false, 'assert(!$this->...') #1 D:\Projects\psalm-bug\vendor\vimeo\psalm\src\Psalm\Internal\PhpVisitor\Reflector\ExpressionScanner.php(171): PhpParser\Node\Expr\CallLike->getArgs() #2 D:\Projects\psalm-bug\vendor\vimeo\psalm\src\Psalm\Internal\PhpVisitor\Reflector\ExpressionScanner.php(87): Psalm\Internal\PhpVisitor\Reflector\ExpressionScanner::registerClassMapFunctionCall(Object(Psalm\Codebase), Object(Psalm\Storage\FileStorage), Object(Psalm\Internal\Scanner\FileScanner), Object(Psalm\Aliases), 'array_map', Object(PhpParser\Node\Expr\FuncCall), NULL, NULL) #3 D:\Projects\psalm-bug\vendor\vimeo\psalm\src\Psalm\Internal\PhpVisitor\ReflectorVisitor.php(346): Psalm\Internal\PhpVisitor\Reflector\ExpressionScanner::scan(Object(Psalm\Codebase), Object(Psalm\Internal\Scanner\FileScanner), Object(Psalm\Storage\FileStorage), Object(Psalm\Aliases), Object(PhpParser\Node\Expr\FuncCall), NULL, NULL) #4 D:\Projects\psalm-bug\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(123): Psalm\Internal\PhpVisitor\ReflectorVisitor->enterNode(Object(PhpParser\Node\Expr\FuncCall)) #5 D:\Projects\psalm-bug\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(223): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Arg)) #6 D:\Projects\psalm-bug\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(114): PhpParser\NodeTraverser->traverseArray(Array) #7 D:\Projects\psalm-bug\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(146): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Expr\FuncCall)) #8 D:\Projects\psalm-bug\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(223): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Expression)) #9 D:\Projects\psalm-bug\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(91): PhpParser\NodeTraverser->traverseArray(Array) #10 D:\Projects\psalm-bug\vendor\vimeo\psalm\src\Psalm\Internal\Scanner\FileScanner.php(88): PhpParser\NodeTraverser->traverse(Array) #11 D:\Projects\psalm-bug\vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Scanner.php(589): Psalm\Internal\Scanner\FileScanner->scan(Object(Psalm\Codebase), Object(Psalm\Storage\FileStorage), false, Object(Psalm\Progress\DefaultProgress)) #12 D:\Projects\psalm-bug\vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Scanner.php(339): Psalm\Internal\Codebase\Scanner->scanFile('D:\\Projects\\psa...', Array, true) #13 D:\Projects\psalm-bug\vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Scanner.php(459): Psalm\Internal\Codebase\Scanner->Psalm\Internal\Codebase\{closure}(0, 'D:\\Projects\\psa...') #14 D:\Projects\psalm-bug\vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Scanner.php(303): Psalm\Internal\Codebase\Scanner->scanFilePaths(1) #15 D:\Projects\psalm-bug\vendor\vimeo\psalm\src\Psalm\Codebase.php(504): Psalm\Internal\Codebase\Scanner->scanFiles(Object(Psalm\Internal\Codebase\ClassLikes), 1) #16 D:\Projects\psalm-bug\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\ProjectAnalyzer.php(639): Psalm\Codebase->scanFiles(1) #17 D:\Projects\psalm-bug\vendor\vimeo\psalm\src\Psalm\Internal\Cli\Psalm.php(377): Psalm\Internal\Analyzer\ProjectAnalyzer->check('D:\\Projects\\psa...', true) #18 D:\Projects\psalm-bug\vendor\vimeo\psalm\psalm(9): Psalm\Internal\Cli\Psalm::run(Array) #19 D:\Projects\psalm-bug\vendor\bin\psalm(107): include('D:\\Projects\\psa...') #20 {main} (Psalm dev-master crashed due to an uncaught Throwable)
The text was updated successfully, but these errors were encountered:
I found these snippets:
Psalm output (using commit b8240e2): No issues!
Sorry, something went wrong.
reproduced with even less: https://psalm.dev/r/2179e51b57
The issue is caused by a special handling for array_map (array_filter must error too)
<?php array_map(...);
@trowski Could you check that one?
Prevent crashes on array_map(...)
array_map(...)
fe036d4
Fixes vimeo#7305
Successfully merging a pull request may close this issue.
Despite #6989 and #7196, it seems the first class callables are still causing some crashes. Here is a simple example (https://psalm.dev/r/2cfb6f69bb)
The text was updated successfully, but these errors were encountered: