TomasVotruba / bladestan

PHPStan analysis for Blade templates
https://tomasvotruba.com/blog/introducing-bladestan-phpstan-analysis-of-blade-templates/
MIT License
286 stars 13 forks source link

Internal error: Internal error: config in file #29

Closed AJenbo closed 1 year ago

AJenbo commented 1 year ago
Internal error: Internal error: config in file /project/app/View/Components/Products/ProductSearch.php                   

Post the following stack trace to https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md:                                                                                   
#0 /project/vendor/nunomaduro/larastan/src/ReturnTypes/AuthExtension.php(50):                                            
Illuminate\Container\Container->get()                                                                                                                                                     
#1 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(3355):                             
NunoMaduro\Larastan\ReturnTypes\AuthExtension->getTypeFromStaticMethodCall()                                                                                                              
#2 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1374):                             
PHPStan\Analyser\MutatingScope->methodCallReturnType()                                                                                                                                    
#3 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1380):                             
PHPStan\Analyser\MutatingScope->PHPStan\Analyser\{closure}()                                                                                                                              
#4 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(556):                              
PHPStan\Analyser\MutatingScope->resolveType()                                                                                                                                             
#5 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1399):                             
PHPStan\Analyser\MutatingScope->getType()                                                                                                                                                 
#6 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1405):                             
PHPStan\Analyser\MutatingScope->PHPStan\Analyser\{closure}()                                                                                                                              
#7 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(556):                              
PHPStan\Analyser\MutatingScope->resolveType()                                                                                                                                             
#8 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(742):                              
PHPStan\Analyser\MutatingScope->getType()                                                                                                                                                 
#9 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(556):                              
PHPStan\Analyser\MutatingScope->resolveType()                                                                                                                                             
#10 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1452):                        
PHPStan\Analyser\MutatingScope->getType()                                                                                                                                                 
#11 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(562):                         
PHPStan\Analyser\NodeScopeResolver->findEarlyTerminatingExpr()                                                                                                                            
#12 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(365):                         
PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                                                                                                                     
#13 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(526):                         
PHPStan\Analyser\NodeScopeResolver->processStmtNodes()                                                                                                                                    
#14 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(365):                         
PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                                                                                                                     
#15 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(604):                         
PHPStan\Analyser\NodeScopeResolver->processStmtNodes()                                                                                                                                    
#16 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(365):                         
PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                                                                                                                     
#17 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(576):                         
PHPStan\Analyser\NodeScopeResolver->processStmtNodes()                                                                                                                                    
#18 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(332):                         
PHPStan\Analyser\NodeScopeResolver->processStmtNode()                                                                                                                                     
#19 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(175):                              
PHPStan\Analyser\NodeScopeResolver->processNodes()                                                                                                                                        
#20 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(134):                              
PHPStan\Analyser\FileAnalyser->analyseFile()                                                                                                                                              
#21                                                                                                                                                                                       
phar:///project/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97):  
PHPStan\Command\WorkerCommand->PHPStan\Command\{closure}()                                                                                                                                
#22 phar:///project/vendor/phpstan/phpstan/phpstan.phar/vendor/clue/ndjson-react/src/Decoder.php(110):                   
_PHPStan_eb00fd21c\Evenement\EventEmitter->emit()                                                                                                                                         
#23                                                                                                                                                                                       
phar:///project/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97):  
_PHPStan_eb00fd21c\Clue\React\NDJson\Decoder->handleData()                                                                                                                                
#24 phar:///project/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/Util.php(62):                            
_PHPStan_eb00fd21c\Evenement\EventEmitter->emit()                                                                                                                                         
#25                                                                                                                                                                                       
phar:///project/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97):  
_PHPStan_eb00fd21c\React\Stream\Util::_PHPStan_eb00fd21c\React\Stream\{closure}()                                                                                                         
#26 phar:///project/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/DuplexResourceStream.php(154):           
_PHPStan_eb00fd21c\Evenement\EventEmitter->emit()                                                                                                                                         
#27 phar:///project/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(201):           
_PHPStan_eb00fd21c\React\Stream\DuplexResourceStream->handleData()                                                                                                                        
#28 phar:///project/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(173):           
_PHPStan_eb00fd21c\React\EventLoop\StreamSelectLoop->waitForStreamActivity()                                                                                                              
#29 phar:///project/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(97):                               
_PHPStan_eb00fd21c\React\EventLoop\StreamSelectLoop->run()                                                                                                                                
#30 phar:///project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259):                 
PHPStan\Command\WorkerCommand->execute()                                                                                                                                                  
#31 phar:///project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(870):                     
_PHPStan_eb00fd21c\Symfony\Component\Console\Command\Command->run()                                                                                                                       
#32 phar:///project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(261):                     
_PHPStan_eb00fd21c\Symfony\Component\Console\Application->doRunCommand()                                                                                                                  
#33 phar:///project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(157):                     
_PHPStan_eb00fd21c\Symfony\Component\Console\Application->doRun()                                                                                                                         
#34 phar:///project/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(124):                                                
_PHPStan_eb00fd21c\Symfony\Component\Console\Application->run()                                                                                                                           
#35 phar:///project/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(125): _PHPStan_eb00fd21c\{closure}()                 
#36 /project/vendor/phpstan/phpstan/phpstan(8): require('...')                                                           
#37 /project/vendor/bin/phpstan(120): include('...')                                                                     
#38 {main}                                                                                                                                                                                
Child process error (exit code 1):
<?php

namespace App\View\Components\Products;

use Illuminate\Support\Facades\Auth;
use Livewire\Component;

class ProductSearch extends Component
{
    public function render(): void
    {
    }

    private function setDefaultValues(): void
    {
        $this->userEmail = Auth::user()->email;
    }
}
AJenbo commented 1 year ago

P.s. sorry for all the noise here in the beginning, I'll try to be more productive once I have solved all the basic issues in our code base :)

AJenbo commented 1 year ago

On a side note this can be used as a workaround:

request()->user()->email

and sometimes when that doesn't work this does:

auth()->user()->email
AJenbo commented 1 year ago

See #30 for a better rundown of the issue as well as a better workaround