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

PHP Fatal error in PHPStan\Command\AnalyseApplication::analyse() #95

Closed
dvandijk opened this issue Jul 8, 2019 · 2 comments · Fixed by #96
Closed

PHP Fatal error in PHPStan\Command\AnalyseApplication::analyse() #95

dvandijk opened this issue Jul 8, 2019 · 2 comments · Fixed by #96

Comments

@dvandijk
Copy link

dvandijk commented Jul 8, 2019

phpstan/phpstan version: 0.11.x-dev#bf4e560b898dd77e5d4b22978e5fddece3d7a364

Error message

PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function PHPStan\Command\AnalyseApplication::analyse(), 6 passed

Reason

phpstan/phpstan/src/Command/AnalyseApplication.php:51

public function analyse(
	array $files,
	bool $onlyFiles,
	OutputStyle $style,
	ErrorFormatter $errorFormatter,
	bool $defaultLevelUsed,
	bool $debug,
	?string $projectConfigFile
)

requires 7 parameters and vendor/mglaman/drupal-check/src/Command/CheckCommand.php only provides 6 of them

$exitCode = $inceptionResult->handleReturn(
	$application->analyse(
		$inceptionResult->getFiles(),
		$inceptionResult->isOnlyFiles(),
		$inceptionResult->getConsoleStyle(),
		$errorFormatter,
		$inceptionResult->isDefaultLevelUsed(),
		$output->getVerbosity() === OutputInterface::VERBOSITY_DEBUG
	)
);

Possible fix

Adding a NULL as the 7th parameter as I don't think an extra projectConfigFile is needed in this case.

$exitCode = $inceptionResult->handleReturn(
	$application->analyse(
		$inceptionResult->getFiles(),
		$inceptionResult->isOnlyFiles(),
		$inceptionResult->getConsoleStyle(),
		$errorFormatter,
		$inceptionResult->isDefaultLevelUsed(),
		$output->getVerbosity() === OutputInterface::VERBOSITY_DEBUG,
		NULL
	)
);
@mikemadison13
Copy link

I can't speak to the potential impact of the NULL addition, but it does get me up and running agin when testing locally.

@goba
Copy link
Sponsor

goba commented Jul 9, 2019

This may be a symptom of the dev phpstan being used. See also #93 for a similar problem.

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