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

Call to undefined method PHPStan\Type\IntersectionType::getClassName() #1567

Closed
matthieumastadenis opened this issue Mar 1, 2023 · 12 comments · Fixed by #1571
Closed

Call to undefined method PHPStan\Type\IntersectionType::getClassName() #1567

matthieumastadenis opened this issue Mar 1, 2023 · 12 comments · Fixed by #1571
Labels
bug Something isn't working

Comments

@matthieumastadenis
Copy link

matthieumastadenis commented Mar 1, 2023

  • PHPStan Version: 1.10.3
  • Larastan Version: 2.4.1
  • --level used: 9

Hello, I have an issue with PHPStan v1.10.3 and Larastan v2.4.1 in a Laravel project since I upgraded it to Laravel 10. I reported it on PHPStan issues tracker and @ondrejmirtes told me it's a bug from Larastan.

Please find bellow a copy of what I already reported to PHPStan: Hello, I have an issue with PHPStan v1.10.3 in a Laravel project since I upgraded it to Laravel 10.

I don't know how to reproduce the problem because the error refers to a getClassName() method, which is never used anywhere in my codebase. I guess this is an internal PHPStan function.

This error is reported from 5 of my classes but I don't know what is so specific about them.

I can't reproduce this issue with https://phpstan.org/try because the code needs Laravel as a dependency.

Below is the output from PHPStan, with the corresponding call trace for 2 of the 5 concerned files (I can't post the 5 call traces here since the output is too long for this form). I hope it can be enough for you to identify what the problem is.

Thanks, please let me know if you need anything else.

 -- ---------------------------------------------------------------------------------------------------------------------------------------------------------------- 
     Error                                                                                                                                                           
 -- ---------------------------------------------------------------------------------------------------------------------------------------------------------------- 
     Child process error (exit code 139): Segmentation fault (core dumped)                                                                                           
                                                                                                                                                                     
     Internal error: Internal error: Call to undefined method PHPStan\Type\IntersectionType::getClassName() in file                                                  
     /home/matthieu/Projects/main-project/src/Subscriptions/ServiceRecurringPeriodWithQuantity.php                                                       
                                                                                                                                                                     
     Post the following stack trace to https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md:                                                         
     #0                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ClassReflection.php(550):                             
     NunoMaduro\Larastan\Properties\HigherOrderCollectionProxyPropertyExtension->getProperty()                                                                       
     #1 phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Type/ObjectType.php(187):                                     
     PHPStan\Reflection\ClassReflection->getProperty()                                                                                                               
     #2                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Type/Generic/GenericObjectType.php(179):                         
     PHPStan\Type\ObjectType->getUnresolvedPropertyPrototype()                                                                                                       
     #3                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Type/Generic/GenericObjectType.php(175):                         
     PHPStan\Type\Generic\GenericObjectType->getUnresolvedPropertyPrototype()                                                                                        
     #4                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(3387):                                
     PHPStan\Type\Generic\GenericObjectType->getProperty()                                                                                                           
     #5                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(3394):                                
     PHPStan\Analyser\MutatingScope->getPropertyReflection()                                                                                                         
     #6                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1399):                                
     PHPStan\Analyser\MutatingScope->propertyFetchType()                                                                                                             
     #7                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1405):                                
     PHPStan\Analyser\MutatingScope->PHPStan\Analyser\{closure}()                                                                                                    
     #8                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(556):                                 
     PHPStan\Analyser\MutatingScope->resolveType()                                                                                                                   
     #9                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(742):                                 
     PHPStan\Analyser\MutatingScope->getType()                                                                                                                       
     #10                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(556):                                 
     PHPStan\Analyser\MutatingScope->resolveType()                                                                                                                   
     #11                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1452):                            
     PHPStan\Analyser\MutatingScope->getType()                                                                                                                       
     #12                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(562):                             
     PHPStan\Analyser\NodeScopeResolver->findEarlyTerminatingExpr()                                                                                                  
     #13                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(365):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                                                                                           
     #14                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(526):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes()                                                                                                          
     #15                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(365):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                                                                                           
     #16                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(604):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes()                                                                                                          
     #17                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(365):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                                                                                           
     #18                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(576):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes()                                                                                                          
     #19                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(332):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                                                                                           
     #20                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(175):                                  
     PHPStan\Analyser\NodeScopeResolver->processNodes()                                                                                                              
     #21                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(134):                                  
     PHPStan\Analyser\FileAnalyser->analyseFile()                                                                                                                    
     #22                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97):  
     PHPStan\Command\WorkerCommand->PHPStan\Command\{closure}()                                                                                                      
     #23                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/clue/ndjson-react/src/Decoder.php(110):                       
     _PHPStan_eb00fd21c\Evenement\EventEmitter->emit()                                                                                                               
     #24                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97):  
     _PHPStan_eb00fd21c\Clue\React\NDJson\Decoder->handleData()                                                                                                      
     #25                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/Util.php(62):                                
     _PHPStan_eb00fd21c\Evenement\EventEmitter->emit()                                                                                                               
     #26                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97):  
     _PHPStan_eb00fd21c\React\Stream\Util::_PHPStan_eb00fd21c\React\Stream\{closure}()                                                                               
     #27                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/DuplexResourceStream.php(154):               
     _PHPStan_eb00fd21c\Evenement\EventEmitter->emit()                                                                                                               
     #28                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(201):               
     _PHPStan_eb00fd21c\React\Stream\DuplexResourceStream->handleData()                                                                                              
     #29                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(173):               
     _PHPStan_eb00fd21c\React\EventLoop\StreamSelectLoop->waitForStreamActivity()                                                                                    
     #30                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(97):                                   
     _PHPStan_eb00fd21c\React\EventLoop\StreamSelectLoop->run()                                                                                                      
     #31                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259):                     
     PHPStan\Command\WorkerCommand->execute()                                                                                                                        
     #32                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(870):                         
     _PHPStan_eb00fd21c\Symfony\Component\Console\Command\Command->run()                                                                                             
     #33                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(261):                         
     _PHPStan_eb00fd21c\Symfony\Component\Console\Application->doRunCommand()                                                                                        
     #34                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(157):                         
     _PHPStan_eb00fd21c\Symfony\Component\Console\Application->doRun()                                                                                               
     #35 phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(124):                                                
     _PHPStan_eb00fd21c\Symfony\Component\Console\Application->run()                                                                                                 
     #36 phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(125):                                                
     _PHPStan_eb00fd21c\{closure}()                                                                                                                                  
     #37 /home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan(8): require('...')                                                           
     #38 /home/matthieu/Projects/main-project/vendor/bin/phpstan(120): include('...')                                                                     
     #39 {main}     
                                                                                                                                                      
     Internal error: Internal error: Call to undefined method PHPStan\Type\IntersectionType::getClassName() in file                                                  
     /home/matthieu/Projects/main-project/src/Subscriptions/ServiceOneShotWithQuantity.php                                                               
                                                                                                                                                                     
     Post the following stack trace to https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md:                                                         
     #0                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ClassReflection.php(550):                             
     NunoMaduro\Larastan\Properties\HigherOrderCollectionProxyPropertyExtension->getProperty()                                                                       
     #1 phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Type/ObjectType.php(187):                                     
     PHPStan\Reflection\ClassReflection->getProperty()                                                                                                               
     #2                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Type/Generic/GenericObjectType.php(179):                         
     PHPStan\Type\ObjectType->getUnresolvedPropertyPrototype()                                                                                                       
     #3                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Type/Generic/GenericObjectType.php(175):                         
     PHPStan\Type\Generic\GenericObjectType->getUnresolvedPropertyPrototype()                                                                                        
     #4                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(3387):                                
     PHPStan\Type\Generic\GenericObjectType->getProperty()                                                                                                           
     #5                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(3394):                                
     PHPStan\Analyser\MutatingScope->getPropertyReflection()                                                                                                         
     #6                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1399):                                
     PHPStan\Analyser\MutatingScope->propertyFetchType()                                                                                                             
     #7                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1405):                                
     PHPStan\Analyser\MutatingScope->PHPStan\Analyser\{closure}()                                                                                                    
     #8                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(556):                                 
     PHPStan\Analyser\MutatingScope->resolveType()                                                                                                                   
     #9                                                                                                                                                              
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Rules/FunctionCallParametersCheck.php(114):                      
     PHPStan\Analyser\MutatingScope->getType()                                                                                                                       
     #10                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Rules/Methods/CallStaticMethodsRule.php(49):                     
     PHPStan\Rules\FunctionCallParametersCheck->check()                                                                                                              
     #11                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(106):                                  
     PHPStan\Rules\Methods\CallStaticMethodsRule->processNode()                                                                                                      
     #12                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Node/ClassStatementsGatherer.php(98):                            
     PHPStan\Analyser\FileAnalyser->PHPStan\Analyser\{closure}()                                                                                                     
     #13                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(511):                             
     PHPStan\Node\ClassStatementsGatherer->__invoke()                                                                                                                
     #14                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(2484):                            
     PHPStan\Analyser\NodeScopeResolver::PHPStan\Analyser\{closure}()                                                                                                
     #15                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1477):                            
     PHPStan\Analyser\NodeScopeResolver->callNodeCallbackWithExpression()                                                                                            
     #16                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1492):                            
     PHPStan\Analyser\NodeScopeResolver->processExprNode()                                                                                                           
     #17                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(2949):                            
     PHPStan\Analyser\NodeScopeResolver->PHPStan\Analyser\{closure}()                                                                                                
     #18                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1500):                            
     PHPStan\Analyser\NodeScopeResolver->processAssignVar()                                                                                                          
     #19                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(563):                             
     PHPStan\Analyser\NodeScopeResolver->processExprNode()                                                                                                           
     #20                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(365):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                                                                                           
     #21                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(526):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes()                                                                                                          
     #22                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(365):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                                                                                           
     #23                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(604):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes()                                                                                                          
     #24                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(365):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                                                                                           
     #25                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(576):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNodes()                                                                                                          
     #26                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(332):                             
     PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                                                                                           
     #27                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(175):                                  
     PHPStan\Analyser\NodeScopeResolver->processNodes()                                                                                                              
     #28                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(134):                                  
     PHPStan\Analyser\FileAnalyser->analyseFile()                                                                                                                    
     #29                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97):  
     PHPStan\Command\WorkerCommand->PHPStan\Command\{closure}()                                                                                                      
     #30                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/clue/ndjson-react/src/Decoder.php(110):                       
     _PHPStan_eb00fd21c\Evenement\EventEmitter->emit()                                                                                                               
     #31                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97):  
     _PHPStan_eb00fd21c\Clue\React\NDJson\Decoder->handleData()                                                                                                      
     #32                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/Util.php(62):                                
     _PHPStan_eb00fd21c\Evenement\EventEmitter->emit()                                                                                                               
     #33                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97):  
     _PHPStan_eb00fd21c\React\Stream\Util::_PHPStan_eb00fd21c\React\Stream\{closure}()                                                                               
     #34                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/DuplexResourceStream.php(154):               
     _PHPStan_eb00fd21c\Evenement\EventEmitter->emit()                                                                                                               
     #35                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(201):               
     _PHPStan_eb00fd21c\React\Stream\DuplexResourceStream->handleData()                                                                                              
     #36                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(173):               
     _PHPStan_eb00fd21c\React\EventLoop\StreamSelectLoop->waitForStreamActivity()                                                                                    
     #37                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(97):                                   
     _PHPStan_eb00fd21c\React\EventLoop\StreamSelectLoop->run()                                                                                                      
     #38                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259):                     
     PHPStan\Command\WorkerCommand->execute()                                                                                                                        
     #39                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(870):                         
     _PHPStan_eb00fd21c\Symfony\Component\Console\Command\Command->run()                                                                                             
     #40                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(261):                         
     _PHPStan_eb00fd21c\Symfony\Component\Console\Application->doRunCommand()                                                                                        
     #41                                                                                                                                                             
     phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(157):                         
     _PHPStan_eb00fd21c\Symfony\Component\Console\Application->doRun()                                                                                               
     #42 phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(124):                                                
     _PHPStan_eb00fd21c\Symfony\Component\Console\Application->run()                                                                                                 
     #43 phar:///home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(125):                                                
     _PHPStan_eb00fd21c\{closure}()                                                                                                                                  
     #44 /home/matthieu/Projects/main-project/vendor/phpstan/phpstan/phpstan(8): require('...')                                                           
     #45 /home/matthieu/Projects/main-project/vendor/bin/phpstan(120): include('...')                                                                     
     #46 {main}                                                                                  
                                                                                                                                                                     
     Child process error (exit code 139): Segmentation fault (core dumped)                                                                                           
                                                                                                                                                                     
     Child process error (exit code 1):      
 -- ---------------------------------------------------------------------------------------------------------------------------------------------------------------- 
@szepeviktor
Copy link
Collaborator

Thank you for your report!

Could you share few lines from src/Subscriptions/ServiceRecurringPeriodWithQuantity.php where the intersection type is present?

@szepeviktor szepeviktor changed the title Child process error (exit code 139): Segmentation fault (core dumped) - Undefined method ::getClassName() Call to undefined method PHPStan\Type\IntersectionType::getClassName() Mar 1, 2023
@dcaswel
Copy link

dcaswel commented Mar 1, 2023

We are experiencing this same issue after upgrading to Laravel 10, PHPStan 1.10.3 and Larastan 2.4.1. We were able to get around it by pinning our Larastan version to 2.4.0 but obviously we would like to be able to upgrade when possible.

@szepeviktor
Copy link
Collaborator

Caused by #1543

@szepeviktor szepeviktor added the bug Something isn't working label Mar 1, 2023
@ondrejmirtes
Copy link
Contributor

Looking at the class: https://github.com/nunomaduro/larastan/blob/master/src/Properties/HigherOrderCollectionProxyPropertyExtension.php

The assumptions in inline /** @var ...*/ are dangerous and wrong. You can delete them, and ask for $collectionType->getObjectClassNames().

@dcaswel
Copy link

dcaswel commented Mar 1, 2023

@szepeviktor It looks like you guys might be finding the issue but in case it helps, I upgraded to 2.4.1 again and looked at the files that it's erroring on and none of them are using Intersection Types. We've only been on PHP 8.1 for a couple months so we haven't started using that kind of stuff yet.

@matthieumastadenis
Copy link
Author

Thanks everyone for your help,

Could you share few lines from src/Subscriptions/ServiceRecurringPeriodWithQuantity.php where the intersection type is present?

I took a closer look at this file and I found what's responsible for triggering this error (for this file only, I still have to inspect the 4 other concerned classes), it's because of a missing type for indexes in a Collection parameter on the constructor:

class ServiceRecurringPeriodWithQuantity {   
    /**
     * @param Collection<ServiceRecurringPeriod> $services_recurring_periods
     */
    public function __construct(Collection $services_recurring_periods) {}
}

It triggers the following error:

     Internal error: Internal error: Call to undefined method PHPStan\Type\IntersectionType::getClassName() in file  
     /home/matthieu/Projects/main-project/src/Subscriptions/ServiceRecurringPeriodWithQuantity.php       
     Run PHPStan with -v option and post the stack trace to:                                                         
     https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md                                            
     Child process error (exit code 1):        

If I add a type for indexes, no error:

class ServiceRecurringPeriodWithQuantity {   
    /**
     * @param Collection<int|string, ServiceRecurringPeriod> $services_recurring_periods
     */
    public function __construct(Collection $services_recurring_periods) {}
}

I hope this can help. Thanks again.

@ZejdCicak
Copy link

I still keep getting this error for UnionType and ObjectType, even after running composer update.

@canvural
Copy link
Collaborator

canvural commented Mar 5, 2023

@ZejdCicak With 2.5.1? Please open a new issue with full example and stacktrace.

@ZejdCicak
Copy link

@canvural It seems like my local PHPStan was not up to date, after updating it no issues. Sorry for the mistake.

@ondrejmirtes
Copy link
Contributor

FYI this problem gave me an idea for a rule (disallow narrowing PHPStan\Type\Type in @var): phpstan/phpstan-src@713b98f

Because @var is like instanceof (already disallowed) but even worse :)

Here's the result on Larastan (not the latest commit, some stuff might already be fixed): https://github.com/phpstan/phpstan/actions/runs/4366265252/jobs/7636058806

@canvural
Copy link
Collaborator

canvural commented Mar 8, 2023

I didn't check the results, I'm on the phone. But one question is that sometimes in the extensions we use @var in the get* methods, because the type is already narrowed down in the has* methods. So in those cases we need to duplicate the checks also in the get* methods?

@ondrejmirtes
Copy link
Contributor

For example: check something in the has* method and return false based on that. Check the same thing in the get* method and throw new ShouldNotHappenException 😊 This is how I do it.

renovate bot referenced this issue in ben-challis/sql-migrations Mar 9, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [phpstan/phpstan](https://togithub.com/phpstan/phpstan) | require-dev
| patch | `^1.10.5` -> `^1.10.6` |

---

### ⚠ Dependency Lookup Warnings ⚠

Warnings were logged while processing this repo. Please check the
Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>phpstan/phpstan</summary>

###
[`v1.10.6`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.6)

[Compare
Source](https://togithub.com/phpstan/phpstan/compare/1.10.5...1.10.6)

# Bleeding edge 🔪

- Report narrowing `PHPStan\Type\Type` interface via `@var`
(phpstan/phpstan-src@713b98f),
[https://github.com/nunomaduro/larastan/issues/1567#issuecomment-1460445389](https://togithub.com/nunomaduro/larastan/issues/1567#issuecomment-1460445389)
- Check invalid PHPDocs in previously unchecked statement types
(phpstan/phpstan-src@9780d35)
- InvalidPHPStanDocTagRule in StubValidator
(phpstan/phpstan-src@9c2552b)

*If you want to see the shape of things to come and adopt bleeding edge
features early, you can include this config file in your project's
`phpstan.neon`:*

    includes:
    	- vendor/phpstan/phpstan/conf/bleedingEdge.neon

*Of course, there are no backwards compatibility guarantees when you
include this file. The behaviour and reported errors can change in minor
versions with this file included. [Learn
more](https://phpstan.org/blog/what-is-bleeding-edge)*

# Improvements 🔧

- InvalidPHPStanDocTagRule - add forgotten handling of ClassConst
(phpstan/phpstan-src@d943d58)

# Bugfixes 🐛

- Fix false positive with `array_combine()` on PHP 8+
([#&#8203;2276](https://togithub.com/phpstan/phpstan-src/pull/2276)),
[#&#8203;9011](https://togithub.com/phpstan/phpstan/issues/9011), thanks
[@&#8203;staabm](https://togithub.com/staabm)!
- Ignore Nop nodes in NodeScopeResolver when creating
UnreachableStatementNode
([#&#8203;2279](https://togithub.com/phpstan/phpstan-src/pull/2279)),
[#&#8203;8966](https://togithub.com/phpstan/phpstan/issues/8966), thanks
[@&#8203;herndlm](https://togithub.com/herndlm)!
- Fix wrong positives about templates in conditional types
([#&#8203;2241](https://togithub.com/phpstan/phpstan-src/pull/2241)),
[#&#8203;8609](https://togithub.com/phpstan/phpstan/issues/8609),
[#&#8203;7310](https://togithub.com/phpstan/phpstan/issues/7310),
[#&#8203;8408](https://togithub.com/phpstan/phpstan/issues/8408), thanks
[@&#8203;KmeCnin](https://togithub.com/KmeCnin)!

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/ben-challis/sql-migrations).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xNTkuMiIsInVwZGF0ZWRJblZlciI6IjM0LjE1OS4yIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot referenced this issue in Lendable/composer-license-checker Mar 10, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [phpstan/phpstan](https://togithub.com/phpstan/phpstan) | require-dev
| patch | `^1.10.4` -> `^1.10.6` |
| [phpunit/phpunit](https://phpunit.de/)
([source](https://togithub.com/sebastianbergmann/phpunit)) | require-dev
| patch | `^10.0.14` -> `^10.0.15` |

---

### Release Notes

<details>
<summary>phpstan/phpstan</summary>

###
[`v1.10.6`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.6)

[Compare
Source](https://togithub.com/phpstan/phpstan/compare/1.10.5...1.10.6)

# Bleeding edge 🔪

- Report narrowing `PHPStan\Type\Type` interface via `@var`
(phpstan/phpstan-src@713b98f),
[https://github.com/nunomaduro/larastan/issues/1567#issuecomment-1460445389](https://togithub.com/nunomaduro/larastan/issues/1567#issuecomment-1460445389)
- Check invalid PHPDocs in previously unchecked statement types
(phpstan/phpstan-src@9780d35)
- InvalidPHPStanDocTagRule in StubValidator
(phpstan/phpstan-src@9c2552b)

*If you want to see the shape of things to come and adopt bleeding edge
features early, you can include this config file in your project's
`phpstan.neon`:*

    includes:
    	- vendor/phpstan/phpstan/conf/bleedingEdge.neon

*Of course, there are no backwards compatibility guarantees when you
include this file. The behaviour and reported errors can change in minor
versions with this file included. [Learn
more](https://phpstan.org/blog/what-is-bleeding-edge)*

# Improvements 🔧

- InvalidPHPStanDocTagRule - add forgotten handling of ClassConst
(phpstan/phpstan-src@d943d58)

# Bugfixes 🐛

- Fix false positive with `array_combine()` on PHP 8+
([#&#8203;2276](https://togithub.com/phpstan/phpstan-src/pull/2276)),
[#&#8203;9011](https://togithub.com/phpstan/phpstan/issues/9011), thanks
[@&#8203;staabm](https://togithub.com/staabm)!
- Ignore Nop nodes in NodeScopeResolver when creating
UnreachableStatementNode
([#&#8203;2279](https://togithub.com/phpstan/phpstan-src/pull/2279)),
[#&#8203;8966](https://togithub.com/phpstan/phpstan/issues/8966), thanks
[@&#8203;herndlm](https://togithub.com/herndlm)!
- Fix wrong positives about templates in conditional types
([#&#8203;2241](https://togithub.com/phpstan/phpstan-src/pull/2241)),
[#&#8203;8609](https://togithub.com/phpstan/phpstan/issues/8609),
[#&#8203;7310](https://togithub.com/phpstan/phpstan/issues/7310),
[#&#8203;8408](https://togithub.com/phpstan/phpstan/issues/8408), thanks
[@&#8203;KmeCnin](https://togithub.com/KmeCnin)!

###
[`v1.10.5`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.5)

[Compare
Source](https://togithub.com/phpstan/phpstan/compare/1.10.4...1.10.5)

# Improvements 🔧

- Check local type aliases above traits
(phpstan/phpstan-src@4654c16)

# Bugfixes 🐛

- Fix type aliases in method-level template types
(phpstan/phpstan-src@c926144),
[#&#8203;9008](https://togithub.com/phpstan/phpstan/issues/9008)
- Fix type aliases in traits
(phpstan/phpstan-src@60021c2),
[#&#8203;5091](https://togithub.com/phpstan/phpstan/issues/5091)
- Fix interface accepting a Closure
(phpstan/phpstan-src@0dbe3ab),
[#&#8203;9006](https://togithub.com/phpstan/phpstan/issues/9006)
- Process enum case expression
(phpstan/phpstan-src@f64b27c),
[#&#8203;9005](https://togithub.com/phpstan/phpstan/issues/9005)
- Fixed missing processing of UseUse and GroupUse
(phpstan/phpstan-src@b797512)

</details>

<details>
<summary>sebastianbergmann/phpunit</summary>

###
[`v10.0.15`](https://togithub.com/sebastianbergmann/phpunit/compare/10.0.14...10.0.15)

[Compare
Source](https://togithub.com/sebastianbergmann/phpunit/compare/10.0.14...10.0.15)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/Lendable/composer-license-checker).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xNTcuMSIsInVwZGF0ZWRJblZlciI6IjM0LjE1OS4yIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
tcarrio referenced this issue in open-feature/php-sdk Mar 11, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [phpstan/phpstan](https://togithub.com/phpstan/phpstan) | require-dev
| minor | `~1.9.0` -> `~1.10.0` |

---

### Release Notes

<details>
<summary>phpstan/phpstan</summary>

###
[`v1.10.6`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.6)

[Compare
Source](https://togithub.com/phpstan/phpstan/compare/1.10.5...1.10.6)

# Bleeding edge 🔪

- Report narrowing `PHPStan\Type\Type` interface via `@var`
(phpstan/phpstan-src@713b98f),
[https://github.com/nunomaduro/larastan/issues/1567#issuecomment-1460445389](https://togithub.com/nunomaduro/larastan/issues/1567#issuecomment-1460445389)
- Check invalid PHPDocs in previously unchecked statement types
(phpstan/phpstan-src@9780d35)
- InvalidPHPStanDocTagRule in StubValidator
(phpstan/phpstan-src@9c2552b)

*If you want to see the shape of things to come and adopt bleeding edge
features early, you can include this config file in your project's
`phpstan.neon`:*

    includes:
    	- vendor/phpstan/phpstan/conf/bleedingEdge.neon

*Of course, there are no backwards compatibility guarantees when you
include this file. The behaviour and reported errors can change in minor
versions with this file included. [Learn
more](https://phpstan.org/blog/what-is-bleeding-edge)*

# Improvements 🔧

- InvalidPHPStanDocTagRule - add forgotten handling of ClassConst
(phpstan/phpstan-src@d943d58)

# Bugfixes 🐛

- Fix false positive with `array_combine()` on PHP 8+
([#&#8203;2276](https://togithub.com/phpstan/phpstan-src/pull/2276)),
[#&#8203;9011](https://togithub.com/phpstan/phpstan/issues/9011), thanks
[@&#8203;staabm](https://togithub.com/staabm)!
- Ignore Nop nodes in NodeScopeResolver when creating
UnreachableStatementNode
([#&#8203;2279](https://togithub.com/phpstan/phpstan-src/pull/2279)),
[#&#8203;8966](https://togithub.com/phpstan/phpstan/issues/8966), thanks
[@&#8203;herndlm](https://togithub.com/herndlm)!
- Fix wrong positives about templates in conditional types
([#&#8203;2241](https://togithub.com/phpstan/phpstan-src/pull/2241)),
[#&#8203;8609](https://togithub.com/phpstan/phpstan/issues/8609),
[#&#8203;7310](https://togithub.com/phpstan/phpstan/issues/7310),
[#&#8203;8408](https://togithub.com/phpstan/phpstan/issues/8408), thanks
[@&#8203;KmeCnin](https://togithub.com/KmeCnin)!

###
[`v1.10.5`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.5)

[Compare
Source](https://togithub.com/phpstan/phpstan/compare/1.10.4...1.10.5)

# Improvements 🔧

- Check local type aliases above traits
(phpstan/phpstan-src@4654c16)

# Bugfixes 🐛

- Fix type aliases in method-level template types
(phpstan/phpstan-src@c926144),
[#&#8203;9008](https://togithub.com/phpstan/phpstan/issues/9008)
- Fix type aliases in traits
(phpstan/phpstan-src@60021c2),
[#&#8203;5091](https://togithub.com/phpstan/phpstan/issues/5091)
- Fix interface accepting a Closure
(phpstan/phpstan-src@0dbe3ab),
[#&#8203;9006](https://togithub.com/phpstan/phpstan/issues/9006)
- Process enum case expression
(phpstan/phpstan-src@f64b27c),
[#&#8203;9005](https://togithub.com/phpstan/phpstan/issues/9005)
- Fixed missing processing of UseUse and GroupUse
(phpstan/phpstan-src@b797512)

###
[`v1.10.4`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.4)

[Compare
Source](https://togithub.com/phpstan/phpstan/compare/1.10.3...1.10.4)

# Improvements 🔧

- Remove 3 leading spaces in PHAR
([#&#8203;2254](https://togithub.com/phpstan/phpstan-src/pull/2254)),
[#&#8203;8952](https://togithub.com/phpstan/phpstan/issues/8952), thanks
[@&#8203;ruudk](https://togithub.com/ruudk)!
- Add missing newline at the end of the file
([#&#8203;2254](https://togithub.com/phpstan/phpstan-src/pull/2254)),
thanks [@&#8203;ruudk](https://togithub.com/ruudk)!
- RuleError interfaces are part of BC promise
(phpstan/phpstan-src@aed9319)
- Update nikic/php-parser
(phpstan/phpstan-src@dda95b4)
- Update BetterReflection
([#&#8203;2274](https://togithub.com/phpstan/phpstan-src/pull/2274)),
[#&#8203;8889](https://togithub.com/phpstan/phpstan/issues/8889)

# Bugfixes 🐛

- Fix bug with `array_column`
([#&#8203;2244](https://togithub.com/phpstan/phpstan-src/pull/2244)),
[#&#8203;8917](https://togithub.com/phpstan/phpstan/issues/8917), thanks
[@&#8203;VincentLanglet](https://togithub.com/VincentLanglet)!
- Improve `filter_var()` handling of a couple of simple scalars and null
([#&#8203;2262](https://togithub.com/phpstan/phpstan-src/pull/2262)),
thanks [@&#8203;herndlm](https://togithub.com/herndlm)!
- Fix `value-of` for multiple enums
(phpstan/phpstan-src@3adc91d),
[#&#8203;8983](https://togithub.com/phpstan/phpstan/issues/8983)
- Fix `->value` on unions of enums
(phpstan/phpstan-src@05b85ba),
[#&#8203;9000](https://togithub.com/phpstan/phpstan/issues/9000)

# Function signature fixes 🤖

- Fix return type of `Ds\Sequence::copy()`
([#&#8203;1954](https://togithub.com/phpstan/phpstan-src/pull/1954)),
thanks [@&#8203;MidnightDesign](https://togithub.com/MidnightDesign)!
- Fix `password_hash()` return type
([#&#8203;2260](https://togithub.com/phpstan/phpstan-src/pull/2260)),
[#&#8203;5978](https://togithub.com/phpstan/phpstan/issues/5978), thanks
[@&#8203;VincentLanglet](https://togithub.com/VincentLanglet)!

###
[`v1.10.3`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.3)

[Compare
Source](https://togithub.com/phpstan/phpstan/compare/1.10.2...1.10.3)

# Improvements 🔧

- Add support for `@not-deprecated` annotation
([#&#8203;2255](https://togithub.com/phpstan/phpstan-src/pull/2255)),
[https://github.com/phpstan/phpstan/discussions/7422](https://togithub.com/phpstan/phpstan/discussions/7422),
thanks [@&#8203;stof](https://togithub.com/stof)!

# Bugfixes 🐛

- Fix arithmetic operations with BenevolentUnionType
(phpstan/phpstan-src@f882eff),
[#&#8203;8938](https://togithub.com/phpstan/phpstan/issues/8938)
- Fix native return type of `array_chunk()`
(phpstan/phpstan-src@e4a6d20),
[#&#8203;8956](https://togithub.com/phpstan/phpstan/issues/8956)
- Support for property fetch in initializers
(phpstan/phpstan-src@53c643d),
[#&#8203;8957](https://togithub.com/phpstan/phpstan/issues/8957)
- ObjectType - fix enum property with subtracted type
(phpstan/phpstan-src@eb00fd2),
[#&#8203;8828](https://togithub.com/phpstan/phpstan/issues/8828),
[#&#8203;8486](https://togithub.com/phpstan/phpstan/issues/8486)

###
[`v1.10.2`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.2)

[Compare
Source](https://togithub.com/phpstan/phpstan/compare/1.10.1...1.10.2)

# Improvements 🔧

- Allow generating baseline in .php format
(phpstan/phpstan-src@8260032),
[#&#8203;8870](https://togithub.com/phpstan/phpstan/issues/8870)
- See documentation:
https://phpstan.org/user-guide/baseline#php-baseline-format-instead-of-neon

# Function signature fixes 🤖

- Instances of `object` returned by `db2_*()` functions are always
instances of `stdClass`
([#&#8203;2249](https://togithub.com/phpstan/phpstan-src/pull/2249)),
thanks [@&#8203;phansys](https://togithub.com/phansys)!

###
[`v1.10.1`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.1)

[Compare
Source](https://togithub.com/phpstan/phpstan/compare/1.10.0...1.10.1)

# Bugfixes 🐛

- Fix match expression and `treatPhpDocTypesAsCertain: false`
([#&#8203;2248](https://togithub.com/phpstan/phpstan-src/pull/2248)),
[#&#8203;8932](https://togithub.com/phpstan/phpstan/issues/8932), thanks
[@&#8203;VincentLanglet](https://togithub.com/VincentLanglet)!
- Fix calling dynamic return type extensions on nullable types
(phpstan/phpstan-src@7331bc5)
- Fix edge case with `in_array` and enums
(phpstan/phpstan-src@7d6f0f6)

###
[`v1.10.0`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.0)

[Compare
Source](https://togithub.com/phpstan/phpstan/compare/1.9.18...1.10.0)

**Read the article about this release: [PHPStan 1.10 Comes With a Lie
Detector](https://phpstan.org/blog/phpstan-1-10-comes-with-lie-detector)**

# Major new features 🚀

- "Always true" conditions in the last `elseif` branch and last match
expression arm are not reported by default
([#&#8203;2105](https://togithub.com/phpstan/phpstan-src/pull/2105)),
[#&#8203;8042](https://togithub.com/phpstan/phpstan/issues/8042),
[#&#8203;8485](https://togithub.com/phpstan/phpstan/issues/8485),
[#&#8203;7721](https://togithub.com/phpstan/phpstan/issues/7721),
[#&#8203;4242](https://togithub.com/phpstan/phpstan/issues/4242),
[#&#8203;8240](https://togithub.com/phpstan/phpstan/issues/8240), thanks
[@&#8203;staabm](https://togithub.com/staabm)!
- Set
[`reportAlwaysTrueInLastCondition`](https://phpstan.org/config-reference#reportalwaystrueinlastcondition)
to `true` to have them reported again
- Note: "Always true" conditions in PHPStan 1.x are reported with
Bleeding Edge enabled, or with phpstan-strict-rules installed, or with
[relevant
options](https://togithub.com/phpstan/phpstan-strict-rules/blob/66b378f5b242130908b8a2222bf8110f14f4375a/rules.neon#L4-L7)
enabled separately. In PHPStan 2.0 they're going to be always reported,
except for the last `elseif` branch and last match expression arm.
- Deprecate various `instanceof *Type` in favour of new methods on
`Type` interface,
(phpstan/phpstan-src@436e6d3),
learn more: [Why Is instanceof \*Type Wrong and Getting
Deprecated?](https://phpstan.org/blog/why-is-instanceof-type-wrong-and-getting-deprecated)
- Deprecations in your custom rules and extensions will be reported in
Bleeding Edge, or with `phpstan-deprecation-rules` installed
- Explain why type isn't accepted by another type in less intuitive
scenarios,
[#&#8203;3281](https://togithub.com/phpstan/phpstan/issues/3281),
[#&#8203;6787](https://togithub.com/phpstan/phpstan/issues/6787)
- Some examples:
https://phpstan.org/r/61cfbb65-1a04-471a-a5c5-d61f0540ae1d,
https://phpstan.org/r/839f1fd2-d66a-4356-af21-3fe171d83fd1,
https://phpstan.org/r/2bea7ece-6b26-4dc9-a1cf-d2f0e7fbb9d6,
https://phpstan.org/r/fed1c275-46d0-434f-b9c4-3212f4df6d1c,
https://phpstan.org/r/24a23b74-af27-4443-986c-04af61427d50

# Bleeding edge 🔪

- Validate inline PHPDoc `@var` tag type against native type
(phpstan/phpstan-src@a69e3bc)
- Set
[`reportWrongPhpDocTypeInVarTag`](https://phpstan.org/config-reference#reportwrongphpdoctypeinvartag)
to `true` to have all types validated, not just native ones
- Always report always true conditions, except for last elseif and match
arm
([#&#8203;2105](https://togithub.com/phpstan/phpstan-src/pull/2105)),
thanks [@&#8203;staabm](https://togithub.com/staabm)!
- Disable "unreachable branches" rules: UnreachableIfBranchesRule,
UnreachableTernaryElseBranchRule, unreachable arm error in
MatchExpressionRule
- Because "always true" is always reported, these are no longer needed
- IncompatibleDefaultParameterTypeRule for closures
(phpstan/phpstan-src@0264f5b)
- New `RuleLevelHelper::accepts()` behaviour
(phpstan/phpstan-src@941fc81)
- Check template type variance in `@param-out`
(phpstan/phpstan-src@7ceb19d),
[https://github.com/phpstan/phpstan/issues/8880#issuecomment-1426971473](https://togithub.com/phpstan/phpstan/issues/8880#issuecomment-1426971473)

*If you want to see the shape of things to come and adopt bleeding edge
features early, you can include this config file in your project's
`phpstan.neon`:*

    includes:
    	- vendor/phpstan/phpstan/conf/bleedingEdge.neon

*Of course, there are no backwards compatibility guarantees when you
include this file. The behaviour and reported errors can change in minor
versions with this file included. [Learn
more](https://phpstan.org/blog/what-is-bleeding-edge)*

# Improvements 🔧

- Implement identical/equal comparisons on EnumCaseObjectType
([#&#8203;2105](https://togithub.com/phpstan/phpstan-src/pull/2105)),
thanks [@&#8203;staabm](https://togithub.com/staabm)!
- MatchExpressionRule - use ConstantConditionRuleHelper to remove some
duplicate errors
(phpstan/phpstan-src@7380ed0)
- Improvements of `MutatingScope::getNativeType()`
([#&#8203;1943](https://togithub.com/phpstan/phpstan-src/pull/1943)),
[#&#8203;4689](https://togithub.com/phpstan/phpstan/issues/4689),
[#&#8203;7578](https://togithub.com/phpstan/phpstan/issues/7578),
[#&#8203;6260](https://togithub.com/phpstan/phpstan/issues/6260)
- Allow default values for allow-private-mutation properties
([#&#8203;2178](https://togithub.com/phpstan/phpstan-src/pull/2178)),
[#&#8203;8701](https://togithub.com/phpstan/phpstan/issues/8701), thanks
[@&#8203;zonuexe](https://togithub.com/zonuexe)!
- Support `treatPhpDocTypesAsCertain` in
NumberComparisonOperatorsConstantConditionRule
(phpstan/phpstan-src@649eb70),
[#&#8203;6776](https://togithub.com/phpstan/phpstan/issues/6776),
[#&#8203;7075](https://togithub.com/phpstan/phpstan/issues/7075)
- JsonErrorFormatter - strip console-specific characters from tip
(phpstan/phpstan-src@6419da7)
- `InClassMethodNode` - add `getClassReflection()`
(phpstan/phpstan-src@c4ee0b8)
- PhpFunctionFromParserNodeReflection and
PhpMethodFromParserNodeReflection are part of BC promise
(phpstan/phpstan-src@8107179)
- AttributesCheck - detect deprecated attributes
(phpstan/phpstan-src@e46b0b4)
- Introduce `Type::getTemplateType()` and deprecate
`GenericTypeVariableResolver`
(phpstan/phpstan-src@b73a8aa,
phpstan/phpstan-src@01b4d4e)
- Implement PHP version dependent loose const comparison
([#&#8203;2220](https://togithub.com/phpstan/phpstan-src/pull/2220),
[#&#8203;2225](https://togithub.com/phpstan/phpstan-src/pull/2225)),
thanks [@&#8203;staabm](https://togithub.com/staabm)!

# Bugfixes 🐛

- Fix LateResolvableTypeTrait
(phpstan/phpstan-src@bc28286)
- StrCaseFunctionsReturnTypeExtension - do not throw
ShouldNotHappenException, it might happen if mbstring is not enabled and
the polyfill is not implemented
(phpstan/phpstan-src@c015e47),
[#&#8203;8925](https://togithub.com/phpstan/phpstan/issues/8925)

# Function signature fixes 🤖

- Fix `PDO::sqliteCreateFunction`
([#&#8203;2208](https://togithub.com/phpstan/phpstan-src/pull/2208)),
[#&#8203;8802](https://togithub.com/phpstan/phpstan/issues/8802), thanks
[@&#8203;VincentLanglet](https://togithub.com/VincentLanglet)!
- Use "numeric-string" type for some MySQLi functions
([#&#8203;2223](https://togithub.com/phpstan/phpstan-src/pull/2223),
[#&#8203;2224](https://togithub.com/phpstan/phpstan-src/pull/2224)),
thanks [@&#8203;phansys](https://togithub.com/phansys)!
- Update param and return type for `db2_autocommit()`
([#&#8203;2239](https://togithub.com/phpstan/phpstan-src/pull/2239)),
thanks [@&#8203;phansys](https://togithub.com/phansys)!

# Internals 🔍

- Deprecate `TypeUtils::getDirectClassNames()` and `instanceof
TypeWithClassName`, use `Type::getObjectClassNames()` instead
([#&#8203;1924](https://togithub.com/phpstan/phpstan-src/pull/1924)),
thanks [@&#8203;herndlm](https://togithub.com/herndlm)!
- Remove dead code in UnionType
([#&#8203;2194](https://togithub.com/phpstan/phpstan-src/pull/2194)),
thanks [@&#8203;staabm](https://togithub.com/staabm)!
- Use `isSuperTypeOf()` instead of `accepts()` in the right places
(phpstan/phpstan-src@ddb9dc5)
- Modernized `IncompatibleDefaultParameterTypeRule`
(phpstan/phpstan-src@a79ad03)
- InClassMethodNode always contains PhpMethodFromParserNodeReflection
(phpstan/phpstan-src@01a7897)
- InFunctionNode always contains PhpFunctionFromParserNodeReflection
(phpstan/phpstan-src@e864b24)
- Modernized InClassMethodNode rules
(phpstan/phpstan-src@c3da6a9)
- Modernized InFunctionNode rules
(phpstan/phpstan-src@b736ddc)
- Introduce `Type::acceptsWithReason()`
(phpstan/phpstan-src@b763bd9),
[#&#8203;3281](https://togithub.com/phpstan/phpstan/issues/3281)
- Fix invalid phpdocs missing null
([#&#8203;2213](https://togithub.com/phpstan/phpstan-src/pull/2213)),
thanks [@&#8203;janedbal](https://togithub.com/janedbal)!
- NodeScopeResolver::earlyTerminatingMethodNames remove useless default
([#&#8203;2214](https://togithub.com/phpstan/phpstan-src/pull/2214)),
[#&#8203;8830](https://togithub.com/phpstan/phpstan/issues/8830), thanks
[@&#8203;janedbal](https://togithub.com/janedbal)!
- Skip `testEditorUrlWithRelativePath()` test on PhpStorm console
([#&#8203;2229](https://togithub.com/phpstan/phpstan-src/pull/2229)),
thanks [@&#8203;staabm](https://togithub.com/staabm)!
- VarianceCheck - accept only ParametersAcceptorWithPhpDocs
(phpstan/phpstan-src@7da13f7)
- Remove duplicate method definition from ConstantType interface
(phpstan/phpstan-src@61fa3a1)
- `Type::isEnum()`
(phpstan/phpstan-src@93113cb)
- `Type::getObjectClassReflections()`
(phpstan/phpstan-src@4c7046e)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/open-feature/php-sdk).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xNDguMCIsInVwZGF0ZWRJblZlciI6IjM0LjE2MC4wIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants