Skip to content

Internal error when used with PHPStan 1.8.x #17

Open
@ffflabs

Description

@ffflabs

Greetings.

Having PHPStan 1.8.4 installed beforehand, I gave this extension a try. It threw the following internal error:

     Internal error: Internal error: PHPStan\Analyser\FileAnalyser::analyseFile(): Argument #4 ($collectorRegistry) must be of type PHPStan\Collectors\Registry, null given, called in /var/www/project/vendor/canvural/phpstan-blade-rule/src/Rules/ViewRuleHelper.php on line 94 in file  
     /var/www/project/app/Http/Controllers/NegocioController.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):   

It turns out PHPStan 1.8.0 introduced a breaking change in its signature for method analyseFile , which now reads:

	public function analyseFile(
		string $file,
		array $analysedFiles,
		RuleRegistry $ruleRegistry,
		CollectorRegistry $collectorRegistry,
		?callable $outerNodeCallback,
	): FileAnalyserResult

whereas, up to version 1.7.15, the same method used to have the signature:

	public function analyseFile(
		string $file,
		array $analysedFiles,
		Registry $registry,
		?callable $outerNodeCallback,
	): FileAnalyserResult

For the time being I have resorted to downgrading and pinning PHPStan, but since I didn't see the issue reported elsewhere, I thought you might want to be given the heads up.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions