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

"System error: "Class League\OAuth2\Client\Grant\RefreshToken was not found while trying to analyse it - red properly." #8748

Closed
wayneh opened this issue Jul 18, 2024 · 2 comments · Fixed by rectorphp/rector-src#6159

Comments

@wayneh
Copy link

wayneh commented Jul 18, 2024

c:\xampp72\htdocs\oldboys>php ../rector-standalone/vendor/bin/rector --dry-run --debug

[ERROR] Could not process "C:\xampp72\htdocs\oldboys\3rdparty\PHPMailer\OAuth.php" file, due to:

     "System error: "Class League\OAuth2\Client\Grant\RefreshToken was not found while trying to analyse it -      
     discovering symbols is probably not configured properly."
                                                
     
                                                                                                         
     Stack trace:
                                                                                             
     #0                                                                                                            
     phar://C:/xampp72/htdocs/rector-standalone/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvid
     er/MemoizingReflectionProvider.php(43):                                                                       
     PHPStan\Reflection\BetterReflection\BetterReflectionProvider->getClass('League\\OAuth2\\C...')                
     #1                                                                                                            
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\rules\TypeDeclaration\Rector\ClassMethod\ReturnTypeFr
     omReturnNewRector.php(188):                                                                                   
     PHPStan\Reflection\ReflectionProvider\MemoizingReflectionProvider->getClass('League\\OAuth2\\C...')           
     #2                                                                                                            
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\rules\TypeDeclaration\Rector\ClassMethod\ReturnTypeFr
     omReturnNewRector.php(223):                                                                                   
     Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector->createObjectTypeFromNew(Object(PhpPa 
     rser\Node\Expr\New_))                                                                                         
     #3                                                                                                            
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\rules\TypeDeclaration\Rector\ClassMethod\ReturnTypeFr
     omReturnNewRector.php(200):                                                                                   
     Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector->resolveReturnNewType(Array)          
     #4                                                                                                            
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\rules\TypeDeclaration\Rector\ClassMethod\ReturnTypeFr
     omReturnNewRector.php(156):                                                                                   
     Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector->refactorDirectReturnNew(Object(PhpPa 
     rser\Node\Stmt\ClassMethod), Array)                                                                           
     #5 C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\src\Rector\AbstractScopeAwareRector.php(27):      
     Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector->refactorWithScope(Object(PhpParser\N 
     ode\Stmt\ClassMethod), Object(PHPStan\Analyser\MutatingScope))                                                
     #6 C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\src\Rector\AbstractRector.php(139):               
     Rector\Rector\AbstractScopeAwareRector->refactor(Object(PhpParser\Node\Stmt\ClassMethod))                     
     #7                                                                                                            
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.p
     hp(176): Rector\Rector\AbstractRector->enterNode(Object(PhpParser\Node\Stmt\ClassMethod))                     
     #8                                                                                                            
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.p
     hp(105): PhpParser\NodeTraverser->traverseArray(Array)                                                        
     #9                                                                                                            
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.p
     hp(196): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Class_))                            
     #10                                                                                                           
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.p
     hp(105): PhpParser\NodeTraverser->traverseArray(Array)                                                        
     #11                                                                                                           
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.p
     hp(196): PhpParser\NodeTraverser->traverseNode(Object(Rector\PhpParser\Node\CustomNode\FileWithoutNamespace)) 
     #12                                                                                                           
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.p
     hp(85): PhpParser\NodeTraverser->traverseArray(Array)                                                         
     #13                                                                                                           
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\src\PhpParser\NodeTraverser\RectorNodeTraverser.php(4
     1): PhpParser\NodeTraverser->traverse(Array)                                                                  
     #14 C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\src\Application\FileProcessor.php(111):          
     Rector\PhpParser\NodeTraverser\RectorNodeTraverser->traverse(Array)                                           
     #15                                                                                                           
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\src\Application\ApplicationFileProcessor.php(182):   
     Rector\Application\FileProcessor->processFile(Object(Rector\ValueObject\Application\File),                    
     Object(Rector\ValueObject\Configuration))                                                                     
     #16                                                                                                           
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\src\Application\ApplicationFileProcessor.php(159):   
     Rector\Application\ApplicationFileProcessor->processFile(Object(Rector\ValueObject\Application\File),         
     Object(Rector\ValueObject\Configuration))                                                                     
     #17                                                                                                           
     C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\src\Application\ApplicationFileProcessor.php(136):   
     Rector\Application\ApplicationFileProcessor->processFiles(Array, Object(Rector\ValueObject\Configuration),    
     Object(Closure), Object(Closure))                                                                             
     #18 C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\src\Console\Command\ProcessCommand.php(131):     
     Rector\Application\ApplicationFileProcessor->run(Object(Rector\ValueObject\Configuration),                    
     Object(RectorPrefix202407\Symfony\Component\Console\Input\ArgvInput))                                         
     #19 C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\vendor\symfony\console\Command\Command.php(327): 
     Rector\Console\Command\ProcessCommand->execute(Object(RectorPrefix202407\Symfony\Component\Console\Input\Argv 
     Input), Object(RectorPrefix202407\Symfony\Component\Console\Output\ConsoleOutput))                            
     #20 C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\vendor\symfony\console\Application.php(960):     
     RectorPrefix202407\Symfony\Component\Console\Command\Command->run(Object(RectorPrefix202407\Symfony\Component 
     \Console\Input\ArgvInput), Object(RectorPrefix202407\Symfony\Component\Console\Output\ConsoleOutput))         
     #21 C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\vendor\symfony\console\Application.php(333):     
     RectorPrefix202407\Symfony\Component\Console\Application->doRunCommand(Object(Rector\Console\Command\ProcessC 
     ommand), Object(RectorPrefix202407\Symfony\Component\Console\Input\ArgvInput),                                
     Object(RectorPrefix202407\Symfony\Component\Console\Output\ConsoleOutput))                                    
     #22 C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\src\Console\ConsoleApplication.php(53):          
     RectorPrefix202407\Symfony\Component\Console\Application->doRun(Object(RectorPrefix202407\Symfony\Component\C 
     onsole\Input\ArgvInput), Object(RectorPrefix202407\Symfony\Component\Console\Output\ConsoleOutput))           
     #23 C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\vendor\symfony\console\Application.php(216):     
     Rector\Console\ConsoleApplication->doRun(Object(RectorPrefix202407\Symfony\Component\Console\Input\ArgvInput) 
     , Object(RectorPrefix202407\Symfony\Component\Console\Output\ConsoleOutput))                                  
     #24 C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\bin\rector.php(130):                             
     RectorPrefix202407\Symfony\Component\Console\Application->run()                                               
     #25 C:\xampp72\htdocs\rector-standalone\vendor\rector\rector\bin\rector(4):                                   
     require_once('C:\\xampp72\\htdo...')                                                                          
     #26 C:\xampp72\htdocs\rector-standalone\vendor\bin\rector(115): include('C:\\xampp72\\htdo...')               
     #27 {main}". On line: 179                                                                                     

OAuth.php.txt

@samsonasik
Copy link
Member

It seems you're using rector from outside project, that can cause autoload jugling, it is better to install rector on the root project, if the issue persist, ensure set autoload when needed, see https://getrector.com/documentation/static-reflection-and-autoload

@staabm
Copy link
Contributor

staabm commented Jul 18, 2024

fixed by rectorphp/rector-src#6159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants