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

Support for phpstan 2? #66

Open
mfn opened this issue Nov 11, 2024 · 5 comments · May be fixed by #68
Open

Support for phpstan 2? #66

mfn opened this issue Nov 11, 2024 · 5 comments · May be fixed by #68

Comments

@mfn
Copy link

mfn commented Nov 11, 2024

phpstan 2.0 was just released:

@extern-kovalenko
Copy link

So update will be or not?

@fabianblum
Copy link

I tested it with phpstan ^2. It seems to work with the current version #67

@extern-kovalenko
Copy link

When you will merge?

@knallcharge
Copy link

Friendly bump to keep this alive :)

@MatuzMark
Copy link

MatuzMark commented Jan 7, 2025

I tried to use with PHPStan version 2.1.1 but it failed with internal error.
I think first it must be fixed, because they made some internal changes, that should be updated by the guide.

My code was

<?php

function fun(): void
{
    try {
        $a = 10;
    } catch (\Throwable $th) {
        //throw $th;
    }
}

The internal error is:

$ vendor/bin/phpstan -v
Note: Using configuration file /var/www/phpstan-test/phpstan.neon.dist.
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% < 1 sec


 Error

 Internal error: PHPStan\Analyser\RuleErrorTransformer::transform(): Argument #1 ($ruleError) must be of type PHPStan\Rules\RuleError, string given, called in phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php on line 119 while analysing file
 /var/www/phpstan-test/alma.php
 Post the following stack trace to https://github.com/phpstan/phpstan/issues/new?template=Bug_report.yaml:
 ## phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/RuleErrorTransformer.php(19)
 #0 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(119): PHPStan\Analyser\RuleErrorTransformer->transform()
 #1 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(572): PHPStan\Analyser\FileAnalyser->PHPStan\Analyser\{closure}()
 #2 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1323): PHPStan\Analyser\NodeScopeResolver::PHPStan\Analyser\{closure}()
 #3 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(450): PHPStan\Analyser\NodeScopeResolver->processStmtNode()
 #4 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(594): PHPStan\Analyser\NodeScopeResolver->processStmtNodes()
 #5 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(398): PHPStan\Analyser\NodeScopeResolver->processStmtNode()
 #6 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(162): PHPStan\Analyser\NodeScopeResolver->processNodes()
 #7 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(136): PHPStan\Analyser\FileAnalyser->analyseFile()
 #8 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/EventEmitterTrait.php(111): PHPStan\Command\WorkerCommand::PHPStan\Command\{closure}()
 #9 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/vendor/clue/ndjson-react/src/Decoder.php(117): _PHPStan_2f712479f\Evenement\EventEmitter->emit()
 #10 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/EventEmitterTrait.php(111): _PHPStan_2f712479f\Clue\React\NDJson\Decoder->handleData()
 #11 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/Util.php(62): _PHPStan_2f712479f\Evenement\EventEmitter->emit()
 #12 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/EventEmitterTrait.php(111): _PHPStan_2f712479f\React\Stream\Util::_PHPStan_2f712479f\React\Stream\{closure}()
 #13 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/DuplexResourceStream.php(168): _PHPStan_2f712479f\Evenement\EventEmitter->emit()
 #14 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(201): _PHPStan_2f712479f\React\Stream\DuplexResourceStream->handleData()
 #15 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(173): _PHPStan_2f712479f\React\EventLoop\StreamSelectLoop->waitForStreamActivity()
 #16 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(96): _PHPStan_2f712479f\React\EventLoop\StreamSelectLoop->run()
 #17 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259): PHPStan\Command\WorkerCommand->execute()
 #18 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(870): _PHPStan_2f712479f\Symfony\Component\Console\Command\Command->run()
 #19 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(261): _PHPStan_2f712479f\Symfony\Component\Console\Application->doRunCommand()
 #20 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(157): _PHPStan_2f712479f\Symfony\Component\Console\Application->doRun()
 #21 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(114): _PHPStan_2f712479f\Symfony\Component\Console\Application->run()
 #22 phar:///var/www/phpstan-test/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(115): _PHPStan_2f712479f\{closure}()
 #23 /var/www/phpstan-test/vendor/phpstan/phpstan/phpstan(8): require('...')
 #24 /var/www/phpstan-test/vendor/bin/phpstan(119): include('...')
 #25 {main}

[ERROR] Found 1 error

⚠️ Result is incomplete because of severe errors. ⚠️
Fix these errors first and then re-run PHPStan
to get all reported errors.

Elapsed time: 1 second
Used memory: 48 MB

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.

5 participants