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 InvalidArgumentException #40

Closed
statniki opened this issue Aug 4, 2022 · 5 comments
Closed

Uncaught InvalidArgumentException #40

statniki opened this issue Aug 4, 2022 · 5 comments

Comments

@statniki
Copy link

statniki commented Aug 4, 2022

I am trying to use following github action:

name: Psalm Static analysis

on: [push, pull_request]

jobs:
  psalm:
    name: Psalm
    runs-on: ubuntu-latest
    permissions:
      actions: read
      contents: read
      security-events: write
        
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Install and Run Psalm
        uses: docker://vimeo/psalm-github-actions
        with:
          security_analysis: true
          report_file: results.sarif 
          
      - name: Upload results to GitHub
        uses: github/codeql-action/upload-sarif@v1
        with:
          sarif_file: results.sarif

It fails with the following error:

Uncaught InvalidArgumentException: Could not get class storage for tcpdf in /composer/vendor/vimeo/psalm/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php:46
Stack trace:
#0 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalyzer.php(181): Psalm\Internal\Provider\ClassLikeStorageProvider->get('TCPDF')
#1 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php(187): Psalm\Internal\Analyzer\Statements\Expression\Call\Method\AtomicMethodCallAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\MethodCall), Object(Psalm\Codebase), Object(Psalm\Context), Object(Psalm\Type\Union), Object(Psalm\Type\Atomic\TNamedObject), Object(Psalm\Type\Atomic\TNamedObject), false, '$this', Object(Psalm\Internal\Analyzer\Statements\Expression\Call\Method\AtomicMethodCallAnalysisResult), NULL)
#2 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(186): Psalm\Internal\Analyzer\Statements\Expression\Call\MethodCallAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\MethodCall), Object(Psalm\Context), true, NULL)
#3 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(86): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\MethodCall), Object(Psalm\Context), false, NULL, true, NULL, false)
#4 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(586): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\MethodCall), Object(Psalm\Context), false, NULL, true)
#5 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(212): Psalm\Internal\Analyzer\StatementsAnalyzer::analyzeStatement(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\Expression), Object(Psalm\Context), NULL)
#6 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php(163): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze(Array, Object(Psalm\Context))
#7 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php(262): Psalm\Internal\Analyzer\Statements\Block\IfElse\IfAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\If_), Object(Psalm\Internal\Scope\IfScope), Object(Psalm\Internal\Scope\IfConditionalScope), Object(Psalm\Context), Object(Psalm\Context), Array)
#8 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(534): Psalm\Internal\Analyzer\Statements\Block\IfElseAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\If_), Object(Psalm\Context))
#9 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(212): Psalm\Internal\Analyzer\StatementsAnalyzer::analyzeStatement(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\If_), Object(Psalm\Context), NULL)
#10 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php(163): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze(Array, Object(Psalm\Context))
#11 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php(262): Psalm\Internal\Analyzer\Statements\Block\IfElse\IfAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\If_), Object(Psalm\Internal\Scope\IfScope), Object(Psalm\Internal\Scope\IfConditionalScope), Object(Psalm\Context), Object(Psalm\Context), Array)
#12 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(534): Psalm\Internal\Analyzer\Statements\Block\IfElseAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\If_), Object(Psalm\Context))
#13 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(212): Psalm\Internal\Analyzer\StatementsAnalyzer::analyzeStatement(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\If_), Object(Psalm\Context), Object(Psalm\Context))
#14 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php(478): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze(Array, Object(Psalm\Context), Object(Psalm\Context), true)
#15 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(1781): Psalm\Internal\Analyzer\FunctionLikeAnalyzer->analyze(Object(Psalm\Context), Object(Psalm\Internal\Provider\NodeDataProvider), Object(Psalm\Context))
#16 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(422): Psalm\Internal\Analyzer\ClassAnalyzer->analyzeClassMethod(Object(PhpParser\Node\Stmt\ClassMethod), Object(Psalm\Storage\ClassLikeStorage), Object(Psalm\Internal\Analyzer\ClassAnalyzer), Object(Psalm\Context), Object(Psalm\Context))
#17 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FileAnalyzer.php(229): Psalm\Internal\Analyzer\ClassAnalyzer->analyze(Object(Psalm\Context), Object(Psalm\Context))
#18 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(1600): Psalm\Internal\Analyzer\FileAnalyzer->analyze()
#19 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(539): Psalm\Internal\Codebase\Analyzer->analysisWorker(356, '/github/workspa...')
#20 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(290): Psalm\Internal\Codebase\Analyzer->doAnalysis(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 1)
#21 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(689): Psalm\Internal\Codebase\Analyzer->analyzeFiles(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 1, false, true)
#22 /composer/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(376): Psalm\Internal\Analyzer\ProjectAnalyzer->check('/github/workspa...', false)
#23 /composer/vendor/vimeo/psalm/psalm(8): Psalm\Internal\Cli\Psalm::run(Array)
#24 /composer/vendor/bin/psalm(115): include('/composer/vendo...')
#25 {main}
(Psalm dev-master@24f7920e9a83d2a2dc18fe1e854d344d7133ad71 crashed due to an uncaught Throwable)

@orklah
Copy link
Contributor

orklah commented Aug 4, 2022

It's more likely a bug in psalm itself rather than a big in the CI configuration. Do you have a way to run psalm without the github action to check?

@statniki
Copy link
Author

statniki commented Aug 4, 2022

Unfortunately, I do not at least at the moment.
I have to assume that I will need to sort out installation of PHP on my local machine for this to happen.

@statniki
Copy link
Author

statniki commented Aug 4, 2022

I setup my environment locally and run psalm --init --debug-by-line against the PHP code. It came back with this error

Uncaught Exception: InvalidArgumentException Could not get class storage for tcpdf
Emitted in /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php:46
Stack trace in the forked worker:
#0 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalyzer.php(178): Psalm\Internal\Provider\ClassLikeStorageProvider->get()
#1 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php(185): Psalm\Internal\Analyzer\Statements\Expression\Call\Method\AtomicMethodCallAnalyzer::analyze()
#2 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(186): Psalm\Internal\Analyzer\Statements\Expression\Call\MethodCallAnalyzer::analyze()
#3 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(78): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression()
#4 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(572): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze()
#5 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(207): Psalm\Internal\Analyzer\StatementsAnalyzer::analyzeStatement()
#6 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php(68): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze()
#7 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php(365): Psalm\Internal\Analyzer\Statements\Block\IfElse\IfAnalyzer::analyze()
#8 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(518): Psalm\Internal\Analyzer\Statements\Block\IfElseAnalyzer::analyze()
#9 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(207): Psalm\Internal\Analyzer\StatementsAnalyzer::analyzeStatement()
#10 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php(68): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze()
#11 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php(365): Psalm\Internal\Analyzer\Statements\Block\IfElse\IfAnalyzer::analyze()
#12 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(518): Psalm\Internal\Analyzer\Statements\Block\IfElseAnalyzer::analyze()
#13 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(207): Psalm\Internal\Analyzer\StatementsAnalyzer::analyzeStatement()
#14 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php(476): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze()
#15 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(1788): Psalm\Internal\Analyzer\FunctionLikeAnalyzer->analyze()
#16 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(425): Psalm\Internal\Analyzer\ClassAnalyzer->analyzeClassMethod()
#17 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FileAnalyzer.php(229): Psalm\Internal\Analyzer\ClassAnalyzer->analyze()
#18 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php(204): Psalm\Internal\Analyzer\FileAnalyzer->analyze()
#19 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(347): Psalm\Internal\Analyzer\Statements\Expression\IncludeAnalyzer::analyze()
#20 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(78): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression()
#21 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(572): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze()
#22 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(207): Psalm\Internal\Analyzer\StatementsAnalyzer::analyzeStatement()
#23 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php(476): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze()
#24 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(1788): Psalm\Internal\Analyzer\FunctionLikeAnalyzer->analyze()
#25 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(425): Psalm\Internal\Analyzer\ClassAnalyzer->analyzeClassMethod()
#26 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FileAnalyzer.php(229): Psalm\Internal\Analyzer\ClassAnalyzer->analyze()
#27 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php(204): Psalm\Internal\Analyzer\FileAnalyzer->analyze()
#28 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(347): Psalm\Internal\Analyzer\Statements\Expression\IncludeAnalyzer::analyze()
#29 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(78): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression()
#30 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(572): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze()
#31 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(207): Psalm\Internal\Analyzer\StatementsAnalyzer::analyzeStatement()
#32 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FileAnalyzer.php(205): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze()
#33 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(362): Psalm\Internal\Analyzer\FileAnalyzer->analyze()
#34 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Fork/Pool.php(211): Psalm\Internal\Codebase\Analyzer->Psalm\Internal\Codebase{closure}()
#35 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(428): Psalm\Internal\Fork\Pool->__construct()
#36 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(291): Psalm\Internal\Codebase\Analyzer->doAnalysis()
#37 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(686): Psalm\Internal\Codebase\Analyzer->analyzeFiles()
#38 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(373): Psalm\Internal\Analyzer\ProjectAnalyzer->check()
#39 /home/statniki/vendor/vimeo/psalm/psalm(7): Psalm\Internal\Cli\Psalm::run()
#40 {main} in /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Fork/Pool.php:402
Stack trace:
#0 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Fork/Pool.php(436): Psalm\Internal\Fork\Pool->readResultsFromChildren()
#1 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(503): Psalm\Internal\Fork\Pool->wait()
#2 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(291): Psalm\Internal\Codebase\Analyzer->doAnalysis()
#3 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(686): Psalm\Internal\Codebase\Analyzer->analyzeFiles()
#4 /home/statniki/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(373): Psalm\Internal\Analyzer\ProjectAnalyzer->check()
#5 /home/statniki/vendor/vimeo/psalm/psalm(7): Psalm\Internal\Cli\Psalm::run()
#6 {main}
(Psalm 4.26.0@6998fabb2bf528b65777bf9941920888d23c03ac crashed due to an uncaught Throwable)

@orklah
Copy link
Contributor

orklah commented Aug 4, 2022

I can't transfer this issue to vimeo/psalm. Could you create the issue there?

@statniki
Copy link
Author

statniki commented Aug 4, 2022

Absolutely, I created new issue there and going to close it here.
vimeo/psalm#8371

@statniki statniki closed this as completed Aug 4, 2022
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

No branches or pull requests

2 participants