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

Internal error #10272

Closed
danepowell opened this issue Dec 8, 2023 · 4 comments
Closed

Internal error #10272

danepowell opened this issue Dec 8, 2023 · 4 comments

Comments

@danepowell
Copy link

Bug report

Run composer install and phpstan analyze on the following feature branch: https://github.com/danepowell/cli/tree/CLI-1071

     ## /Users/dane.powell/src/acquia/cli/vendor/jangregor/phpstan-prophecy/src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php(70)
     #0 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(3545):
     JanGregor\Prophecy\Type\Prophet\ProphesizeDynamicReturnTypeExtension->getTypeFromMethodCall(Object(PHPStan\Reflection\ResolvedMethodReflection), Object(PhpParser\Node\Expr\MethodCall), Object(PHPStan\Analyser\MutatingScope))
     #1 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1392): PHPStan\Analyser\MutatingScope->methodCallReturnType(Object(PHPStan\Type\ObjectType), 'prophesize',
     Object(PhpParser\Node\Expr\MethodCall))
     #2 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1398): PHPStan\Analyser\MutatingScope->PHPStan\Analyser\{closure}()
     #3 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(574): PHPStan\Analyser\MutatingScope->resolveType('$this->prophet-...', Object(PhpParser\Node\Expr\MethodCall))
     #4 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(777): PHPStan\Analyser\MutatingScope->getType(Object(PhpParser\Node\Expr\MethodCall))
     #5 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(574): PHPStan\Analyser\MutatingScope->resolveType('$guzzleClient =...', Object(PhpParser\Node\Expr\Assign))
     #6 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1581): PHPStan\Analyser\MutatingScope->getType(Object(PhpParser\Node\Expr\Assign))
     #7 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(627): PHPStan\Analyser\NodeScopeResolver->findEarlyTerminatingExpr(Object(PhpParser\Node\Expr\Assign),
     Object(PHPStan\Analyser\MutatingScope))
     #8 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(402): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Expression), Object(PHPStan\Analyser\MutatingScope),
     Object(Closure), Object(PHPStan\Analyser\StatementContext))
     #9 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(567): PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\ClassMethod), Array,
     Object(PHPStan\Analyser\MutatingScope), Object(Closure), Object(PHPStan\Analyser\StatementContext))
     #10 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(402): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\ClassMethod),
     Object(PHPStan\Analyser\MutatingScope), Object(PHPStan\Node\ClassStatementsGatherer), Object(PHPStan\Analyser\StatementContext))
     #11 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(669): PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\Class_), Array,
     Object(PHPStan\Analyser\MutatingScope), Object(PHPStan\Node\ClassStatementsGatherer), Object(PHPStan\Analyser\StatementContext))
     #12 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(402): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Class_), Object(PHPStan\Analyser\MutatingScope),
     Object(Closure), Object(PHPStan\Analyser\StatementContext))
     #13 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(641): PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\Namespace_), Array,
     Object(PHPStan\Analyser\MutatingScope), Object(Closure), Object(PHPStan\Analyser\StatementContext))
     #14 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(371): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Namespace_), Object(PHPStan\Analyser\MutatingScope),
     Object(Closure), Object(PHPStan\Analyser\StatementContext))
     #15 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(166): PHPStan\Analyser\NodeScopeResolver->processNodes(Array, Object(PHPStan\Analyser\MutatingScope), Object(Closure))
     #16 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(132): PHPStan\Analyser\FileAnalyser->analyseFile('/Users/dane.pow...', Array, Object(PHPStan\Rules\LazyRegistry),
     Object(PHPStan\Collectors\Registry), NULL)
     #17 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97): PHPStan\Command\WorkerCommand->PHPStan\Command\{closure}(Array)
     #18 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/vendor/clue/ndjson-react/src/Decoder.php(117): _PHPStan_f73a165d5\Evenement\EventEmitter->emit('data', Array)
     #19 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97): _PHPStan_f73a165d5\Clue\React\NDJson\Decoder->handleData(Array)
     #20 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/Util.php(62): _PHPStan_f73a165d5\Evenement\EventEmitter->emit('data', Array)
     #21 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97): _PHPStan_f73a165d5\React\Stream\Util::_PHPStan_f73a165d5\React\Stream\{closure}('{"action":"anal...')
     #22 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/DuplexResourceStream.php(154): _PHPStan_f73a165d5\Evenement\EventEmitter->emit('data', Array)
     #23 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(201): _PHPStan_f73a165d5\React\Stream\DuplexResourceStream->handleData(Resource id #5174)
     #24 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(173): _PHPStan_f73a165d5\React\EventLoop\StreamSelectLoop->waitForStreamActivity(NULL)
     #25 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(98): _PHPStan_f73a165d5\React\EventLoop\StreamSelectLoop->run()
     #26 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259): PHPStan\Command\WorkerCommand->execute(Object(_PHPStan_f73a165d5\Symfony\Component\Console\Input\ArgvInput),
     Object(_PHPStan_f73a165d5\Symfony\Component\Console\Output\ConsoleOutput))
     #27 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(870):
     _PHPStan_f73a165d5\Symfony\Component\Console\Command\Command->run(Object(_PHPStan_f73a165d5\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_f73a165d5\Symfony\Component\Console\Output\ConsoleOutput))
     #28 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(261): _PHPStan_f73a165d5\Symfony\Component\Console\Application->doRunCommand(Object(PHPStan\Command\WorkerCommand),
     Object(_PHPStan_f73a165d5\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_f73a165d5\Symfony\Component\Console\Output\ConsoleOutput))
     #29 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(157):
     _PHPStan_f73a165d5\Symfony\Component\Console\Application->doRun(Object(_PHPStan_f73a165d5\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_f73a165d5\Symfony\Component\Console\Output\ConsoleOutput))
     #30 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(124): _PHPStan_f73a165d5\Symfony\Component\Console\Application->run()
     #31 phar:///Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(125): _PHPStan_f73a165d5\{closure}()
     #32 /Users/dane.powell/src/acquia/cli/vendor/phpstan/phpstan/phpstan(8): require('phar:///Users/d...')
     #33 /Users/dane.powell/src/acquia/cli/vendor/bin/phpstan(119): include('/Users/dane.pow...')
     #34 {main}

Code snippet that reproduces the problem

https://github.com/danepowell/cli/tree/CLI-1071

Expected output

No crash :)

Did PHPStan help you today? Did it make you happy in any way?

No response

Copy link

mergeable bot commented Dec 8, 2023

This bug report is missing a link to reproduction at phpstan.org/try.

It will most likely be closed after manual review.

@ondrejmirtes
Copy link
Member

The stack trace contains jangregor/phpstan-prophecy, please report the bug there.

@danepowell
Copy link
Author

danepowell commented Dec 11, 2023

Thanks, you are right, this is a regression caused by phpspec/prophecy 1.18: Jan0707/phpstan-prophecy#315

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants