Skip to content

Error while phpstan analyse #14040

@Adi-18

Description

@Adi-18

Bug report

Error occurs after I installed phpstan/phpstan-doctrine and add in my phpstan.dist.neon

includes:
    - vendor/phpstan/phpstan-doctrine/extension.neon

vendor/bin/phpstan analyse src -v
Note: Using configuration file /var/www/offerte-demo.studersond.ch/phpstan.dist.neon.
98/98 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% 12 secs


 Error                                                                                                                                                                                                                    

 Internal error: Cannot instantiate custom generator : array (                                                                                                                                                            
   'class' => 'doctrine.uuid_generator',                                                                                                                                                                                  
 ) while analysing file /var/www/offerte-demo.studersond.ch/src/DataFixtures/UserFixtures.php                                                                                                                             
 Post the following stack trace to https://github.com/phpstan/phpstan/issues/new?template=Bug_report.yaml:                                                                                                                
 ## /var/www/offerte-demo.studersond.ch/vendor/doctrine/orm/src/Mapping/Exception/InvalidCustomGenerator.php(23)                                                                                                          
 #0 /var/www/offerte-demo.studersond.ch/vendor/doctrine/orm/src/Mapping/ClassMetadataFactory.php(608): Doctrine\ORM\Mapping\Exception\InvalidCustomGenerator::onMissingClass()                                            
 #1 /var/www/offerte-demo.studersond.ch/vendor/doctrine/orm/src/Mapping/ClassMetadataFactory.php(178): Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping()                                            
 #2 /var/www/offerte-demo.studersond.ch/vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php(318): Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata()                            
 #3 /var/www/offerte-demo.studersond.ch/vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php(205): Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata()              
 #4 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/ObjectMetadataResolver.php(128): Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor()                    
 #5 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/GetRepositoryDynamicReturnTypeExtension.php(152): PHPStan\Type\Doctrine\ObjectMetadataResolver->getClassMetadata()              
 #6 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/GetRepositoryDynamicReturnTypeExtension.php(109):                                                                               
 PHPStan\Type\Doctrine\GetRepositoryDynamicReturnTypeExtension->getRepositoryClass()                                                                                                                                      
 #7 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(4007): PHPStan\Type\Doctrine\GetRepositoryDynamicReturnTypeExtension->getTypeFromMethodCall()           
 #8 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1568): PHPStan\Analyser\MutatingScope->methodCallReturnType()                                           
 #9 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(642): PHPStan\Analyser\MutatingScope->resolveType()                                                     
 #10 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/QueryBuilder/ReturnQueryBuilderExpressionTypeResolverExtension.php(77): PHPStan\Analyser\MutatingScope->getType()              
 #11 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/QueryBuilder/ReturnQueryBuilderExpressionTypeResolverExtension.php(45):                                                        
 PHPStan\Type\Doctrine\QueryBuilder\ReturnQueryBuilderExpressionTypeResolverExtension->getMethodReflection()                                                                                                              
 #12 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(681): PHPStan\Type\Doctrine\QueryBuilder\ReturnQueryBuilderExpressionTypeResolverExtension->getType()  
 #13 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(642): PHPStan\Analyser\MutatingScope->resolveType()                                                    
 #14 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/QueryBuilder/ReturnQueryBuilderExpressionTypeResolverExtension.php(77): PHPStan\Analyser\MutatingScope->getType()              
 #15 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/QueryBuilder/ReturnQueryBuilderExpressionTypeResolverExtension.php(45):                                                        
 PHPStan\Type\Doctrine\QueryBuilder\ReturnQueryBuilderExpressionTypeResolverExtension->getMethodReflection()                                                                                                              
 #16 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(681): PHPStan\Type\Doctrine\QueryBuilder\ReturnQueryBuilderExpressionTypeResolverExtension->getType()  
 #17 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(642): PHPStan\Analyser\MutatingScope->resolveType()                                                    
 #18 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(856): PHPStan\Analyser\MutatingScope->getType()                                                        
 #19 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(642): PHPStan\Analyser\MutatingScope->resolveType()                                                    
 #20 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(2016): PHPStan\Analyser\MutatingScope->getType()                                                   
 #21 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(788): PHPStan\Analyser\NodeScopeResolver->findEarlyTerminatingExpr()                               
 #22 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(494): PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                        
 #23 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(687): PHPStan\Analyser\NodeScopeResolver->processStmtNodesInternal()                               
 #24 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(494): PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                        
 #25 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(891): PHPStan\Analyser\NodeScopeResolver->processStmtNodesInternal()                               
 #26 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(494): PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                        
 #27 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(822): PHPStan\Analyser\NodeScopeResolver->processStmtNodesInternal()                               
 #28 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(434): PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                        
 #29 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(221): PHPStan\Analyser\NodeScopeResolver->processNodes()                                                
 #30 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(149): PHPStan\Analyser\FileAnalyser->analyseFile()                                                      
 #31 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/EventEmitterTrait.php(111):                                                                            
 PHPStan\Command\WorkerCommand::{closure:PHPStan\Command\WorkerCommand::runWorker():126}()                                                                                                                                
 #32 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/clue/ndjson-react/src/Decoder.php(117): _PHPStan_5adafcbb8\Evenement\EventEmitter->emit()                                      
 #33 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/EventEmitterTrait.php(111): _PHPStan_5adafcbb8\Clue\React\NDJson\Decoder->handleData()                 
 #34 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/Util.php(62): _PHPStan_5adafcbb8\Evenement\EventEmitter->emit()                                               
 #35 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/EventEmitterTrait.php(111):                                                                            
 _PHPStan_5adafcbb8\React\Stream\Util::{closure:_PHPStan_5adafcbb8\React\Stream\Util::forwardEvents():61}()                                                                                                               
 #36 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/DuplexResourceStream.php(168): _PHPStan_5adafcbb8\Evenement\EventEmitter->emit()                              
 #37 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(201): _PHPStan_5adafcbb8\React\Stream\DuplexResourceStream->handleData()             
 #38 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(173): _PHPStan_5adafcbb8\React\EventLoop\StreamSelectLoop->waitForStreamActivity()   
 #39 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(105): _PHPStan_5adafcbb8\React\EventLoop\StreamSelectLoop->run()                                        
 #40 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259): PHPStan\Command\WorkerCommand->execute()                                             
 #41 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(868): _PHPStan_5adafcbb8\Symfony\Component\Console\Command\Command->run()                      
 #42 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(261): _PHPStan_5adafcbb8\Symfony\Component\Console\Application->doRunCommand()                 
 #43 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(157): _PHPStan_5adafcbb8\Symfony\Component\Console\Application->doRun()                        
 #44 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(99): _PHPStan_5adafcbb8\Symfony\Component\Console\Application->run()                                                      
 #45 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(100): {closure:phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan:14}()           
 #46 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan(8): require('...')                                                                                                                                
 #47 /var/www/offerte-demo.studersond.ch/vendor/bin/phpstan(119): include('...')                                                                                                                                          
 #48 {main}                                                                                                                                                                                                               

Code snippet that reproduces the problem

No response

Expected output

No this kind of error.

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

No response

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