Skip to content

encountered Internal error: Bit shift by negative number in file #7490

@tbali0524

Description

@tbali0524

Bug report

I encountered an internal error while using phpstan v1.7.14

  • OS: Windows 11
  • PHP runtime: v8.6.1
  • Using without composer, the phar file downloaded today from https://github.com/phpstan/phpstan/releases
  • command line php phpstan.phar > .build\phpstan_result.txt
  • using config file phpstan.neon:
parameters:
    level: 0
    phpVersion: 70400
    paths:
        - .
    tmpDir: .build/phpstan
 -- ------------------------------------------------------------------------------------------------------------------- 
     Error                                                                                                              
 -- ------------------------------------------------------------------------------------------------------------------- 
     Internal error: Internal error: Bit shift by negative number in file                                               
     D:\Coding\PHP\CodinGame_solutions\puzzle\community\expert\expert_com_cubax_folding.php                             
                                                                                                                        
     Post the following stack trace to https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md:            
     #0 phar://C:/devtools/phpstan.phar/src/Analyser/MutatingScope.php(888):                                            
     PHPStan\Reflection\InitializerExprTypeResolver->getShiftLeftType(Object(PhpParser\Node\Scalar\LNumber),            
     Object(PhpParser\Node\Expr\Variable), Object(Closure))                                                             
     #1 phar://C:/devtools/phpstan.phar/src/Analyser/MutatingScope.php(556):                                            
     PHPStan\Analyser\MutatingScope->resolveType(Object(PhpParser\Node\Expr\BinaryOp\ShiftLeft))                        
     #2 phar://C:/devtools/phpstan.phar/src/Analyser/MutatingScope.php(807):                                            
     PHPStan\Analyser\MutatingScope->getType(Object(PhpParser\Node\Expr\BinaryOp\ShiftLeft))                            
     #3 phar://C:/devtools/phpstan.phar/src/Reflection/InitializerExprTypeResolver.php(483):                            
     PHPStan\Analyser\MutatingScope->PHPStan\Analyser\{closure}(Object(PhpParser\Node\Expr\BinaryOp\ShiftLeft))         
     #4 phar://C:/devtools/phpstan.phar/src/Analyser/MutatingScope.php(808):                                            
     PHPStan\Reflection\InitializerExprTypeResolver->getBitwiseOrType(Object(PhpParser\Node\Expr\Variable),             
     Object(PhpParser\Node\Expr\BinaryOp\ShiftLeft), Object(Closure))                                                   
     #5 phar://C:/devtools/phpstan.phar/src/Analyser/MutatingScope.php(556):                                            
     PHPStan\Analyser\MutatingScope->resolveType(Object(PhpParser\Node\Expr\AssignOp\BitwiseOr))                        
     #6 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(2603):                                       
     PHPStan\Analyser\MutatingScope->getType(Object(PhpParser\Node\Expr\AssignOp\BitwiseOr))                            
     #7 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(1428):                                       
     PHPStan\Analyser\NodeScopeResolver->processAssignVar(Object(PHPStan\Analyser\MutatingScope),                       
     Object(PhpParser\Node\Expr\Variable), Object(PhpParser\Node\Expr\AssignOp\BitwiseOr), Object(Closure),             
     Object(PHPStan\Analyser\ExpressionContext), Object(Closure), false)                                                
     #8 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(512):                                        
     PHPStan\Analyser\NodeScopeResolver->processExprNode(Object(PhpParser\Node\Expr\AssignOp\BitwiseOr),                
     Object(PHPStan\Analyser\MutatingScope), Object(Closure), Object(PHPStan\Analyser\ExpressionContext))               
     #9 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(325):                                        
     PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Expression),                        
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #10 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(866):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\For_), Array,                      
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #11 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(325):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\For_),                              
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #12 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(866):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\For_), Array,                      
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #13 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(325):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\For_),                              
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #14 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(866):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\For_), Array,                      
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #15 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(325):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\For_),                              
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #16 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(866):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\For_), Array,                      
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #17 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(325):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\For_),                              
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #18 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(866):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\For_), Array,                      
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #19 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(325):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\For_),                              
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #20 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(866):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\For_), Array,                      
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #21 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(325):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\For_),                              
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #22 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(475):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\ClassMethod), Array,               
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #23 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(325):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\ClassMethod),                       
     Object(PHPStan\Analyser\MutatingScope), Object(PHPStan\Node\ClassStatementsGatherer))                              
     #24 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(553):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\Class_), Array,                    
     Object(PHPStan\Analyser\MutatingScope), Object(PHPStan\Node\ClassStatementsGatherer))                              
     #25 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(325):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Class_),                            
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #26 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(525):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\Namespace_), Array,                
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #27 phar://C:/devtools/phpstan.phar/src/Analyser/NodeScopeResolver.php(296):                                       
     PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Namespace_),                        
     Object(PHPStan\Analyser\MutatingScope), Object(Closure))                                                           
     #28 phar://C:/devtools/phpstan.phar/src/Analyser/FileAnalyser.php(189):                                            
     PHPStan\Analyser\NodeScopeResolver->processNodes(Array, Object(PHPStan\Analyser\MutatingScope), Object(Closure))   
     #29 phar://C:/devtools/phpstan.phar/src/Command/WorkerCommand.php(143):                                            
     PHPStan\Analyser\FileAnalyser->analyseFile('D:\\Coding\\PHP\\C...', Array, Object(PHPStan\Rules\Registry), NULL)   
     #30 phar://C:/devtools/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97):            
     PHPStan\Command\WorkerCommand->PHPStan\Command\{closure}(Array)                                                    
     #31 phar://C:/devtools/phpstan.phar/vendor/clue/ndjson-react/src/Decoder.php(110):                                 
     _PHPStan_c2e813828\Evenement\EventEmitter->emit('data', Array)                                                     
     #32 phar://C:/devtools/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97):            
     _PHPStan_c2e813828\Clue\React\NDJson\Decoder->handleData(Array)                                                    
     #33 phar://C:/devtools/phpstan.phar/vendor/react/stream/src/Util.php(62):                                          
     _PHPStan_c2e813828\Evenement\EventEmitter->emit('data', Array)                                                     
     #34 phar://C:/devtools/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97):            
     _PHPStan_c2e813828\React\Stream\Util::_PHPStan_c2e813828\React\Stream\{closure}('{"action":"anal...')              
     #35 phar://C:/devtools/phpstan.phar/vendor/react/stream/src/DuplexResourceStream.php(154):                         
     _PHPStan_c2e813828\Evenement\EventEmitter->emit('data', Array)                                                     
     #36 phar://C:/devtools/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(201):                         
     _PHPStan_c2e813828\React\Stream\DuplexResourceStream->handleData(Resource id #3746)                                
     #37 phar://C:/devtools/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(173):                         
     _PHPStan_c2e813828\React\EventLoop\StreamSelectLoop->waitForStreamActivity(NULL)                                   
     #38 phar://C:/devtools/phpstan.phar/src/Command/WorkerCommand.php(106):                                            
     _PHPStan_c2e813828\React\EventLoop\StreamSelectLoop->run()                                                         
     #39 phar://C:/devtools/phpstan.phar/vendor/symfony/console/Command/Command.php(259):                               
     PHPStan\Command\WorkerCommand->execute(Object(_PHPStan_c2e813828\Symfony\Component\Console\Input\ArgvInput),       
     Object(_PHPStan_c2e813828\Symfony\Component\Console\Output\ConsoleOutput))                                         
     #40 phar://C:/devtools/phpstan.phar/vendor/symfony/console/Application.php(856):                                   
     _PHPStan_c2e813828\Symfony\Component\Console\Command\Command->run(Object(_PHPStan_c2e813828\Symfony\Component\Con  
     sole\Input\ArgvInput), Object(_PHPStan_c2e813828\Symfony\Component\Console\Output\ConsoleOutput))                  
     #41 phar://C:/devtools/phpstan.phar/vendor/symfony/console/Application.php(259):                                   
     _PHPStan_c2e813828\Symfony\Component\Console\Application->doRunCommand(Object(PHPStan\Command\WorkerCommand),      
     Object(_PHPStan_c2e813828\Symfony\Component\Console\Input\ArgvInput),                                              
     Object(_PHPStan_c2e813828\Symfony\Component\Console\Output\ConsoleOutput))                                         
     #42 phar://C:/devtools/phpstan.phar/vendor/symfony/console/Application.php(157):                                   
     _PHPStan_c2e813828\Symfony\Component\Console\Application->doRun(Object(_PHPStan_c2e813828\Symfony\Component\Conso  
     le\Input\ArgvInput), Object(_PHPStan_c2e813828\Symfony\Component\Console\Output\ConsoleOutput))                    
     #43 phar://C:/devtools/phpstan.phar/bin/phpstan(127):                                                              
     _PHPStan_c2e813828\Symfony\Component\Console\Application->run()                                                    
     #44 phar://C:/devtools/phpstan.phar/bin/phpstan(128): _PHPStan_c2e813828\{closure}()                               
     #45 C:\devtools\phpstan.phar(6): require('phar://C:/devto...')                                                     
     #46 {main}                                                                                                         
     Child process error (exit code 1):                                                                                 
 -- ------------------------------------------------------------------------------------------------------------------- 


 [ERROR] Found 2 errors                                                                                                

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions