Add parameter for php version to static analysis command

[MAILPOET-3296]
This commit is contained in:
Rostislav Wolny
2020-12-02 13:28:37 +01:00
committed by Veljko V
parent dd3538b78d
commit 3845f400b1
5 changed files with 21 additions and 8 deletions

View File

@ -491,7 +491,7 @@ class RoboFile extends \Robo\Tasks {
}
}
public function qaPhpstan() {
public function qaPhpstan(array $opts=['php-version' => null]) {
$dir = __DIR__;
$task = implode(' ', [
'WP_ROOT="' . getenv('WP_ROOT') . '"',
@ -499,6 +499,10 @@ class RoboFile extends \Robo\Tasks {
"$dir/tasks/phpstan/vendor/bin/phpstan analyse ",
]);
if ($opts['php-version'] !== null) {
$task = "ANALYSIS_PHP_VERSION={$opts['php-version']} $task";
}
// PHPStan must be run out of main plugin directory to avoid its autoloading
// from vendor/autoload.php where some dev dependencies cause conflicts.
return $this->collectionBuilder()