Skip to content

Error while phpstan analyse #722

@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()                                            
 phpstan/phpstan#1 /var/www/offerte-demo.studersond.ch/vendor/doctrine/orm/src/Mapping/ClassMetadataFactory.php(178): Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping()                                            
 phpstan/phpstan#2 /var/www/offerte-demo.studersond.ch/vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php(318): Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata()                            
 phpstan/phpstan#3 /var/www/offerte-demo.studersond.ch/vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php(205): Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata()              
 phpstan/phpstan#4 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/ObjectMetadataResolver.php(128): Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor()                    
 phpstan/phpstan#5 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/GetRepositoryDynamicReturnTypeExtension.php(152): PHPStan\Type\Doctrine\ObjectMetadataResolver->getClassMetadata()              
 phpstan/phpstan#6 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/GetRepositoryDynamicReturnTypeExtension.php(109):                                                                               
 PHPStan\Type\Doctrine\GetRepositoryDynamicReturnTypeExtension->getRepositoryClass()                                                                                                                                      
 phpstan/phpstan#7 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(4007): PHPStan\Type\Doctrine\GetRepositoryDynamicReturnTypeExtension->getTypeFromMethodCall()           
 phpstan/phpstan#8 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1568): PHPStan\Analyser\MutatingScope->methodCallReturnType()                                           
 phpstan/phpstan#9 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(642): PHPStan\Analyser\MutatingScope->resolveType()                                                     
 phpstan/phpstan#10 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/QueryBuilder/ReturnQueryBuilderExpressionTypeResolverExtension.php(77): PHPStan\Analyser\MutatingScope->getType()              
 phpstan/phpstan#11 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/QueryBuilder/ReturnQueryBuilderExpressionTypeResolverExtension.php(45):                                                        
 PHPStan\Type\Doctrine\QueryBuilder\ReturnQueryBuilderExpressionTypeResolverExtension->getMethodReflection()                                                                                                              
 phpstan/phpstan#12 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(681): PHPStan\Type\Doctrine\QueryBuilder\ReturnQueryBuilderExpressionTypeResolverExtension->getType()  
 phpstan/phpstan#13 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(642): PHPStan\Analyser\MutatingScope->resolveType()                                                    
 phpstan/phpstan#14 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/QueryBuilder/ReturnQueryBuilderExpressionTypeResolverExtension.php(77): PHPStan\Analyser\MutatingScope->getType()              
 phpstan/phpstan#15 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan-doctrine/src/Type/Doctrine/QueryBuilder/ReturnQueryBuilderExpressionTypeResolverExtension.php(45):                                                        
 PHPStan\Type\Doctrine\QueryBuilder\ReturnQueryBuilderExpressionTypeResolverExtension->getMethodReflection()                                                                                                              
 phpstan/phpstan#16 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(681): PHPStan\Type\Doctrine\QueryBuilder\ReturnQueryBuilderExpressionTypeResolverExtension->getType()  
 phpstan/phpstan#17 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(642): PHPStan\Analyser\MutatingScope->resolveType()                                                    
 phpstan/phpstan#18 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(856): PHPStan\Analyser\MutatingScope->getType()                                                        
 phpstan/phpstan#19 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(642): PHPStan\Analyser\MutatingScope->resolveType()                                                    
 phpstan/phpstan#20 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(2016): PHPStan\Analyser\MutatingScope->getType()                                                   
 phpstan/phpstan#21 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(788): PHPStan\Analyser\NodeScopeResolver->findEarlyTerminatingExpr()                               
 phpstan/phpstan#22 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(494): PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                        
 phpstan/phpstan#23 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(687): PHPStan\Analyser\NodeScopeResolver->processStmtNodesInternal()                               
 phpstan/phpstan#24 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(494): PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                        
 phpstan/phpstan#25 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(891): PHPStan\Analyser\NodeScopeResolver->processStmtNodesInternal()                               
 phpstan/phpstan#26 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(494): PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                        
 phpstan/phpstan#27 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(822): PHPStan\Analyser\NodeScopeResolver->processStmtNodesInternal()                               
 phpstan/phpstan#28 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(434): PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                        
 phpstan/phpstan#29 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(221): PHPStan\Analyser\NodeScopeResolver->processNodes()                                                
 phpstan/phpstan#30 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(149): PHPStan\Analyser\FileAnalyser->analyseFile()                                                      
 phpstan/phpstan#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}()                                                                                                                                
 phpstan/phpstan#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()                                      
 phpstan/phpstan#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()                 
 phpstan/phpstan#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()                                               
 phpstan/phpstan#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}()                                                                                                               
 phpstan/phpstan#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()                              
 phpstan/phpstan#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()             
 phpstan/phpstan#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()   
 phpstan/phpstan#39 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(105): _PHPStan_5adafcbb8\React\EventLoop\StreamSelectLoop->run()                                        
 phpstan/phpstan#40 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259): PHPStan\Command\WorkerCommand->execute()                                             
 phpstan/phpstan#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()                      
 phpstan/phpstan#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()                 
 phpstan/phpstan#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()                        
 phpstan/phpstan#44 phar:///var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(99): _PHPStan_5adafcbb8\Symfony\Component\Console\Application->run()                                                      
 phpstan/phpstan#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}()           
 phpstan/phpstan#46 /var/www/offerte-demo.studersond.ch/vendor/phpstan/phpstan/phpstan(8): require('...')                                                                                                                                
 phpstan/phpstan#47 /var/www/offerte-demo.studersond.ch/vendor/bin/phpstan(119): include('...')                                                                                                                                          
 phpstan/phpstan#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