Skip to content
New issue

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

Uncaught Psalm\Exception\CodeException: Error with core stub file docblocks: InvalidDocblock #9886

Closed
DRoss66 opened this issue Jun 8, 2023 · 9 comments · Fixed by #9942
Closed

Comments

@DRoss66
Copy link

DRoss66 commented Jun 8, 2023

This error started showing up last night during our Psalm scan and is causing a crash. Are there any suggestions on how to move past this? I'm relatively new to Psalm and PHP, so apologies if this is obvious.

`Scanning files...
Uncaught Psalm\Exception\CodeException: Error with core stub file docblocks: InvalidDocblock - ../../composer/vendor/vimeo/psalm/stubs/CoreGenericFunctions.phpstub:1737:1 - Template F has invalid as type - int-mask types must all be integer values in /composer/vendor/vimeo/psalm/src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php:571

Stack trace:
#0 /composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(230): Psalm\Internal\PhpVisitor\ReflectorVisitor->leaveNode()
#1 /composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(91): PhpParser\NodeTraverser->traverseArray()
#2 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Scanner/FileScanner.php(79): PhpParser\NodeTraverser->traverse()
#3 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(554): Psalm\Internal\Scanner\FileScanner->scan()
#4 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(782): Psalm\Internal\Codebase\Scanner->scanFile()
#5 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(428): Psalm\Internal\Codebase\Scanner->scanAPath()
#6 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(280): Psalm\Internal\Codebase\Scanner->scanFilePaths()
#7 /composer/vendor/vimeo/psalm/src/Psalm/Codebase.php(505): Psalm\Internal\Codebase\Scanner->scanFiles()
#8 /composer/vendor/vimeo/psalm/src/Psalm/Config.php(2297): Psalm\Codebase->scanFiles()
#9 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(551): Psalm\Config->visitStubFiles()
#10 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(370): Psalm\Internal\Analyzer\ProjectAnalyzer->check()
#11 /composer/vendor/vimeo/psalm/psalm(9): Psalm\Internal\Cli\Psalm::run()
#12 /composer/vendor/bin/psalm(119): include('...')
#13 {main}
(Psalm dev-master@99a54fb7bbdf498c3f997323d977b50af6212 crashed due to an uncaught Throwable)
##[debug]Docker Action run completed with exit code 1
##[debug]Finishing: Psalm`

@psalm-github-bot
Copy link

Hey @DRoss66, can you reproduce the issue on https://psalm.dev ?

@orklah
Copy link
Collaborator

orklah commented Jun 8, 2023

uh, weird, someone made a similar feedback yesterday on slack.

Could you run with --debug-by-line and post here the few lines around where Psalm stops?

@DRoss66
Copy link
Author

DRoss66 commented Jun 8, 2023

I am using Psalm Github Actions, so not sure how to run with the --debug-by-line in my yml file. I don't have command line access to run this.

@ygottschalk
Copy link
Contributor

Is the repo open source? If so, a link would be helpful.
If not, can you provide a reproducer? A small repo containing a similar github actions yml and a bit of sample code to show the error.
If not, you can try to locate the psalm command in the .yml (something like this) and add --debug-by-line to that and post the (relevant parts of the) results.
Also some info about the system / github runner could be helpful. ubuntu / debian / ... / windows ... stuff like that

@DRoss66
Copy link
Author

DRoss66 commented Jun 8, 2023

We were able to determine that 2 days ago, the method that is throwing the exception was added added via this PR.
#9878

In light of that, we are able to use a previous docker image of Psalm and avoid the error for the moment. I am sorry but I can't share our code. The runner we are using is Ubuntu.

@ygottschalk
Copy link
Contributor

@orklah I think it is because one of the GLOB_* constants is not defined, this will not work.
Can we stub those constants if they do not exist on the system?

@DRoss66 which php version?

@orklah
Copy link
Collaborator

orklah commented Jun 9, 2023

yeah we can stub those

@DRoss66
Copy link
Author

DRoss66 commented Jun 9, 2023

PHP Version 7.4. thanks!

@ygottschalk
Copy link
Contributor

@DRoss66 does the changes in PR #9942 fix your issue?

do not have any time rn, will do style-fix at weekend. then this can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants