feat: Ability to run Fixer with parallel runner 馃帀 #9521
Annotations
10 warnings
PHP 8.3 mutation tests:
src/Console/Application.php#L69
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
$this->add(new ListFilesCommand($this->toolInfo));
$this->add(new ListSetsCommand());
$this->add(new SelfUpdateCommand(new NewVersionChecker(new GithubClient()), $this->toolInfo, new PharChecker()));
- $this->add(new WorkerCommand($this->toolInfo));
+
}
public static function getMajorVersion() : int
{
|
PHP 8.3 mutation tests:
src/Console/Application.php#L184
Escaped Mutant for Mutator "InstanceOf_":
--- Original
+++ New
@@ @@
// we need to capture the output of the child process to determine it there was an exception.
// Default render format is not machine-friendly, so we need to override it for `worker` command,
// in order to be able to easily parse exception data for further displaying on main process' side.
- if ($this->executedCommand instanceof WorkerCommand) {
+ if (true) {
$output->writeln(WorkerCommand::ERROR_PREFIX . json_encode(['message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'code' => $e->getCode(), 'trace' => $e->getTraceAsString()]));
return;
}
|
PHP 8.3 mutation tests:
src/Console/Application.php#L188
Escaped Mutant for Mutator "ArrayItem":
--- Original
+++ New
@@ @@
// Default render format is not machine-friendly, so we need to override it for `worker` command,
// in order to be able to easily parse exception data for further displaying on main process' side.
if ($this->executedCommand instanceof WorkerCommand) {
- $output->writeln(WorkerCommand::ERROR_PREFIX . json_encode(['message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'code' => $e->getCode(), 'trace' => $e->getTraceAsString()]));
+ $output->writeln(WorkerCommand::ERROR_PREFIX . json_encode(['message' => $e->getMessage(), 'file' > $e->getFile(), 'line' => $e->getLine(), 'code' => $e->getCode(), 'trace' => $e->getTraceAsString()]));
return;
}
parent::doRenderThrowable($e, $output);
}
}
|
PHP 8.3 mutation tests:
src/Console/Application.php#L189
Escaped Mutant for Mutator "ArrayItem":
--- Original
+++ New
@@ @@
// Default render format is not machine-friendly, so we need to override it for `worker` command,
// in order to be able to easily parse exception data for further displaying on main process' side.
if ($this->executedCommand instanceof WorkerCommand) {
- $output->writeln(WorkerCommand::ERROR_PREFIX . json_encode(['message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'code' => $e->getCode(), 'trace' => $e->getTraceAsString()]));
+ $output->writeln(WorkerCommand::ERROR_PREFIX . json_encode(['message' => $e->getMessage(), 'file' => $e->getFile(), 'line' > $e->getLine(), 'code' => $e->getCode(), 'trace' => $e->getTraceAsString()]));
return;
}
parent::doRenderThrowable($e, $output);
}
}
|
PHP 8.3 mutation tests:
src/Console/Application.php#L190
Escaped Mutant for Mutator "ArrayItem":
--- Original
+++ New
@@ @@
// Default render format is not machine-friendly, so we need to override it for `worker` command,
// in order to be able to easily parse exception data for further displaying on main process' side.
if ($this->executedCommand instanceof WorkerCommand) {
- $output->writeln(WorkerCommand::ERROR_PREFIX . json_encode(['message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'code' => $e->getCode(), 'trace' => $e->getTraceAsString()]));
+ $output->writeln(WorkerCommand::ERROR_PREFIX . json_encode(['message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'code' > $e->getCode(), 'trace' => $e->getTraceAsString()]));
return;
}
parent::doRenderThrowable($e, $output);
}
}
|
PHP 8.3 mutation tests:
src/Console/Application.php#L191
Escaped Mutant for Mutator "ArrayItem":
--- Original
+++ New
@@ @@
// Default render format is not machine-friendly, so we need to override it for `worker` command,
// in order to be able to easily parse exception data for further displaying on main process' side.
if ($this->executedCommand instanceof WorkerCommand) {
- $output->writeln(WorkerCommand::ERROR_PREFIX . json_encode(['message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'code' => $e->getCode(), 'trace' => $e->getTraceAsString()]));
+ $output->writeln(WorkerCommand::ERROR_PREFIX . json_encode(['message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'code' => $e->getCode(), 'trace' > $e->getTraceAsString()]));
return;
}
parent::doRenderThrowable($e, $output);
}
}
|
PHP 8.3 mutation tests:
src/Console/Command/FixCommand.php#L235
Escaped Mutant for Mutator "ArrayItemRemoval":
--- Original
+++ New
@@ @@
if (null !== $passedConfig && null !== $passedRules) {
throw new InvalidConfigurationException('Passing both `--config` and `--rules` options is not allowed.');
}
- $resolver = new ConfigurationResolver($this->defaultConfig, ['allow-risky' => $input->getOption('allow-risky'), 'config' => $passedConfig, 'dry-run' => $this->isDryRun($input), 'rules' => $passedRules, 'path' => $input->getArgument('path'), 'path-mode' => $input->getOption('path-mode'), 'using-cache' => $input->getOption('using-cache'), 'cache-file' => $input->getOption('cache-file'), 'format' => $input->getOption('format'), 'diff' => $input->getOption('diff'), 'stop-on-violation' => $input->getOption('stop-on-violation'), 'verbosity' => $verbosity, 'show-progress' => $input->getOption('show-progress'), 'sequential' => $input->getOption('sequential')], getcwd(), $this->toolInfo);
+ $resolver = new ConfigurationResolver($this->defaultConfig, ['config' => $passedConfig, 'dry-run' => $this->isDryRun($input), 'rules' => $passedRules, 'path' => $input->getArgument('path'), 'path-mode' => $input->getOption('path-mode'), 'using-cache' => $input->getOption('using-cache'), 'cache-file' => $input->getOption('cache-file'), 'format' => $input->getOption('format'), 'diff' => $input->getOption('diff'), 'stop-on-violation' => $input->getOption('stop-on-violation'), 'verbosity' => $verbosity, 'show-progress' => $input->getOption('show-progress'), 'sequential' => $input->getOption('sequential')], getcwd(), $this->toolInfo);
$reporter = $resolver->getReporter();
$stdErr = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : ('txt' === $reporter->getFormat() ? $output : null);
if (null !== $stdErr) {
|
PHP 8.3 mutation tests:
src/Console/Command/FixCommand.php#L276
Escaped Mutant for Mutator "IfNegation":
--- Original
+++ New
@@ @@
$isParallel = $resolver->getParallelConfig()->getMaxProcesses() > 1;
$stdErr->writeln(sprintf('Running analysis on %d core%s.', $resolver->getParallelConfig()->getMaxProcesses(), $isParallel ? sprintf('s with %d file%s per process', $resolver->getParallelConfig()->getFilesPerProcess(), $resolver->getParallelConfig()->getFilesPerProcess() > 1 ? 's' : '') : ' sequentially'));
// @todo remove when parallel runner is mature enough and works as expected
- if ($isParallel) {
+ if (!$isParallel) {
$stdErr->writeln(sprintf($stdErr->isDecorated() ? '<bg=yellow;fg=black;>%s</>' : '%s', 'Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!'));
}
$configFile = $resolver->getConfigFile();
|
PHP 8.3 mutation tests:
src/Console/Command/FixCommand.php#L277
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
$stdErr->writeln(sprintf('Running analysis on %d core%s.', $resolver->getParallelConfig()->getMaxProcesses(), $isParallel ? sprintf('s with %d file%s per process', $resolver->getParallelConfig()->getFilesPerProcess(), $resolver->getParallelConfig()->getFilesPerProcess() > 1 ? 's' : '') : ' sequentially'));
// @todo remove when parallel runner is mature enough and works as expected
if ($isParallel) {
- $stdErr->writeln(sprintf($stdErr->isDecorated() ? '<bg=yellow;fg=black;>%s</>' : '%s', 'Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!'));
+
}
$configFile = $resolver->getConfigFile();
$stdErr->writeln(sprintf('Loaded config <comment>%s</comment>%s.', $resolver->getConfig()->getName(), null === $configFile ? '' : ' from "' . $configFile . '"'));
|
PHP 8.3 mutation tests:
src/Console/Command/FixCommand.php#L279
Escaped Mutant for Mutator "Ternary":
--- Original
+++ New
@@ @@
$stdErr->writeln(sprintf('Running analysis on %d core%s.', $resolver->getParallelConfig()->getMaxProcesses(), $isParallel ? sprintf('s with %d file%s per process', $resolver->getParallelConfig()->getFilesPerProcess(), $resolver->getParallelConfig()->getFilesPerProcess() > 1 ? 's' : '') : ' sequentially'));
// @todo remove when parallel runner is mature enough and works as expected
if ($isParallel) {
- $stdErr->writeln(sprintf($stdErr->isDecorated() ? '<bg=yellow;fg=black;>%s</>' : '%s', 'Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!'));
+ $stdErr->writeln(sprintf($stdErr->isDecorated() ? '%s' : '<bg=yellow;fg=black;>%s</>', 'Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!'));
}
$configFile = $resolver->getConfigFile();
$stdErr->writeln(sprintf('Loaded config <comment>%s</comment>%s.', $resolver->getConfig()->getName(), null === $configFile ? '' : ' from "' . $configFile . '"'));
|