Skip to content
Snippets Groups Projects
Commit ecb58bb0 authored by James Gilliland's avatar James Gilliland Committed by Tim Hestenes Lehnen
Browse files

Support custom phpstan rules

Allow core and contrib to run phpstan how ever it likes.
parent a4319d15
No related branches found
No related merge requests found
......@@ -83,16 +83,20 @@ class Phpstan extends BuildTaskBase implements BuildStepInterface, BuildTaskInte
return 0;
}
$this->addPhpstanNeon();
// Run phpstan.
$source_dir = $this->environment->getExecContainerSourceDir();
$project_dir = $this->codebase->getProjectConfigDirectory(FALSE);
$work_dir = $this->environment->getContainerWorkDir();
$this->io->writeln('<info>Running PHPStan at ' . $source_dir);
// If phpstan file is missing, provide some basic deprecation checks.
if (!file_exists($work_dir . '/phpstan.neon') || !file_exists($work_dir . '/phpstan.neon.dist')) {
$this->addPhpstanNeon();
$neon = '-c ' . $work_dir . '/' . $this->pluginDir . '/phpstan.neon';
}
$result = $this->execEnvironmentCommands([
'cd ' . $project_dir . ' && sudo -u www-data ' . $source_dir . static::$phpstanExecutable . ' analyse --error-format checkstyle -c ' . $work_dir . '/' . $this->pluginDir . '/phpstan.neon . > ' . $work_dir . '/' . $this->pluginDir . '/phpstan_results.xml',
'cd ' . $project_dir . ' && sudo -u www-data ' . $source_dir . static::$phpstanExecutable . ' analyse --error-format checkstyle ' . $neon . ' > ' . $work_dir . '/' . $this->pluginDir . '/phpstan_results.xml',
]);
// Save phpstan results for later examination.
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment