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: ConstantArrayTypeBuilder #7554

Closed
zonuexe opened this issue Jun 30, 2022 · 3 comments
Closed

Internal error: ConstantArrayTypeBuilder #7554

zonuexe opened this issue Jun 30, 2022 · 3 comments
Labels
Milestone

Comments

@zonuexe
Copy link
Contributor

zonuexe commented Jun 30, 2022

Bug report

Analyzing PsySH causes an error in src/Readline/Readline.php file.

Code snippet that reproduces the problem

phpstan analyze -v ./src/Readline/Hoa/Readline.php
error log
% phpstan --version
PHPStan - PHP Static Analysis Tool 1.8.0

% phpstan analyze -v ./src/Readline/Hoa/Readline.php
 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% < 1 sec

 -- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     Error
 -- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     Internal error: Internal error: Internal error. in file /Users/megurine/repo/php/psysh/src/Readline/Hoa/Readline.php

     Post the following stack trace to https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md:
     #0 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Type/Constant/ConstantArrayType.php(420): PHPStan\Type\Constant\ConstantArrayTypeBuilder->setOffsetValueType(Object(PHPStan\Type\Constant\ConstantIntegerType),
     Object(PHPStan\Type\IntegerRangeType))
     #1 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(2412): PHPStan\Type\Constant\ConstantArrayType->setOffsetValueType(Object(PHPStan\Type\Constant\ConstantIntegerType),
     Object(PHPStan\Type\IntegerRangeType))
     #2 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(2585): PHPStan\Analyser\MutatingScope->specifyExpressionType(Object(PhpParser\Node\Expr\ArrayDimFetch), Object(PHPStan\Type\IntegerRangeType),
     Object(PHPStan\Type\IntegerRangeType))
     #3 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(2539): PHPStan\Analyser\MutatingScope->filterBySpecifiedTypes(Object(PHPStan\Analyser\SpecifiedTypes))
     #4 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1849): PHPStan\Analyser\MutatingScope->filterByTruthyValue(Object(PhpParser\Node\Expr\BinaryOp\BooleanAnd))
     #5 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/ExpressionResult.php(69): PHPStan\Analyser\NodeScopeResolver::PHPStan\Analyser\{closure}()
     #6 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(864): PHPStan\Analyser\ExpressionResult->getTruthyScope()
     #7 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(326): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\For_), Object(PHPStan\Analyser\MutatingScope),
     Object(Closure))
     #8 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(484): PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\ClassMethod), Array,
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))
     #9 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(326): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\ClassMethod), Object(PHPStan\Analyser\MutatingScope),
     Object(PHPStan\Node\ClassStatementsGatherer))
     #10 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(562): PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\Class_), Array,
     Object(PHPStan\Analyser\MutatingScope), Object(PHPStan\Node\ClassStatementsGatherer))
     #11 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(326): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Class_), Object(PHPStan\Analyser\MutatingScope),
     Object(Closure))
     #12 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(534): PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\Namespace_), Array,
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))
     #13 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(296): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Namespace_), Object(PHPStan\Analyser\MutatingScope),
     Object(Closure))
     #14 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(174): PHPStan\Analyser\NodeScopeResolver->processNodes(Array, Object(PHPStan\Analyser\MutatingScope), Object(Closure))
     #15 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(147): PHPStan\Analyser\FileAnalyser->analyseFile('/Users/megurine...', Array, Object(PHPStan\Rules\Registry),
     Object(PHPStan\Collectors\Registry), NULL)
     #16 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97): PHPStan\Command\WorkerCommand->PHPStan\Command\{closure}(Array)
     #17 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/vendor/clue/ndjson-react/src/Decoder.php(110): _PHPStan_59fb0a3b2\Evenement\EventEmitter->emit('data', Array)
     #18 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97): _PHPStan_59fb0a3b2\Clue\React\NDJson\Decoder->handleData(Array)
     #19 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/Util.php(62): _PHPStan_59fb0a3b2\Evenement\EventEmitter->emit('data', Array)
     #20 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97): _PHPStan_59fb0a3b2\React\Stream\Util::_PHPStan_59fb0a3b2\React\Stream\{closure}('{"action":"anal...')
     #21 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/DuplexResourceStream.php(154): _PHPStan_59fb0a3b2\Evenement\EventEmitter->emit('data', Array)
     #22 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(201): _PHPStan_59fb0a3b2\React\Stream\DuplexResourceStream->handleData(Resource id #3281)
     #23 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(173): _PHPStan_59fb0a3b2\React\EventLoop\StreamSelectLoop->waitForStreamActivity(NULL)
     #24 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(107): _PHPStan_59fb0a3b2\React\EventLoop\StreamSelectLoop->run()
     #25 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259): PHPStan\Command\WorkerCommand->execute(Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Input\ArgvInput),
     Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Output\ConsoleOutput))
     #26 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(856):
     _PHPStan_59fb0a3b2\Symfony\Component\Console\Command\Command->run(Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Output\ConsoleOutput))
     #27 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(259): _PHPStan_59fb0a3b2\Symfony\Component\Console\Application->doRunCommand(Object(PHPStan\Command\WorkerCommand),
     Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Output\ConsoleOutput))
     #28 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(157):
     _PHPStan_59fb0a3b2\Symfony\Component\Console\Application->doRun(Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_59fb0a3b2\Symfony\Component\Console\Output\ConsoleOutput))
     #29 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(127): _PHPStan_59fb0a3b2\Symfony\Component\Console\Application->run()
     #30 phar:///Users/megurine/.composer/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(128): _PHPStan_59fb0a3b2\{closure}()
     #31 /Users/megurine/.composer/vendor/phpstan/phpstan/phpstan(8): require('phar:///Users/m...')
     #32 /Users/megurine/.composer/vendor/bin/phpstan(117): include('/Users/megurine...')
     #33 {main}
     Child process error (exit code 1):
 -- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



 [ERROR] Found 2 errors


Used memory: 76 MB

Expected output

No internal error.

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

PHPStan 1.8 hasn't raised any other errors for our application, and it's exciting to us!

@mergeable
Copy link

mergeable bot commented Jun 30, 2022

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

Fixed: phpstan/phpstan-src#1486

@github-actions
Copy link

github-actions bot commented Aug 2, 2022

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 Aug 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants