Skip to content

Commit 30f26cc

Browse files
committed
Apply standards
Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
1 parent 5185871 commit 30f26cc

4 files changed

Lines changed: 21 additions & 15 deletions

File tree

src/Command/AbstractCommand.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use Symfony\Component\Console\Helper\ProcessHelper;
2222
use Composer\Command\BaseCommand;
2323
use Composer\InstalledVersions;
24-
use Symfony\Component\Console\Input\ArgvInput;
2524
use Symfony\Component\Console\Input\ArrayInput;
2625
use Symfony\Component\Console\Input\InputInterface;
2726
use Symfony\Component\Console\Output\OutputInterface;
@@ -62,18 +61,16 @@ protected function runProcess(Process $command, OutputInterface $output): int
6261
if (Process::isTtySupported()) {
6362
$command->setTty(true);
6463
} else {
65-
$output->writeln('<comment>Warning: TTY is not supported. The command may not display output as expected.</comment>');
64+
$output->writeln(
65+
'<comment>Warning: TTY is not supported. The command may not display output as expected.</comment>'
66+
);
6667

67-
$callback = function (string $type, string $buffer) use ($output) {
68+
$callback = function (string $type, string $buffer) use ($output): void {
6869
$output->write($buffer);
6970
};
7071
}
7172

72-
$process = $processHelper->run(
73-
output: $output,
74-
cmd: $command,
75-
callback: $callback
76-
);
73+
$process = $processHelper->run(output: $output, cmd: $command, callback: $callback);
7774

7875
if (! $process->isSuccessful()) {
7976
$output->writeln(\sprintf(
@@ -142,6 +139,7 @@ protected function runCommand(string $commandName, array|InputInterface $input,
142139
$application = $this->getApplication();
143140

144141
$command = $application->find($commandName);
142+
$command->ignoreValidationErrors();
145143

146144
if (\is_array($input)) {
147145
$input = new ArrayInput($input);

src/Command/ReportsCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5353
$coveragePath = $this->getAbsolutePath('public/coverage');
5454

5555
$output->writeln('<info>Generating API documentation on path: ' . $docsPath . '</info>');
56-
$this->runCommand('docs', ['--target' => $docsPath], $output);
56+
$this->runCommand('docs', [
57+
'--target' => $docsPath,
58+
], $output);
5759

5860
$output->writeln('<info>Generating test coverage report on path: ' . $coveragePath . '</info>');
59-
$this->runCommand('tests', ['--coverage' => $coveragePath], $output);
61+
$this->runCommand('tests', [
62+
'--coverage' => $coveragePath,
63+
], $output);
6064

6165
$this->generateFrontpage();
6266

src/Command/TestsCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9090
}
9191

9292
if ($input->getOption('coverage')) {
93-
$output->writeln('<info>Generating code coverage reports on path: ' . $this->resolvePath($input, 'coverage') . '</info>');
93+
$output->writeln(
94+
'<info>Generating code coverage reports on path: ' . $this->resolvePath($input, 'coverage') . '</info>'
95+
);
9496

9597
foreach ($this->getPsr4Namespaces() as $path) {
9698
$arguments[] = '--coverage-filter=' . $this->getAbsolutePath($path);

src/Composer/Plugin.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ public function getCapabilities(): array
4646
public function activate(Composer $composer, IOInterface $io): void
4747
{
4848
// Add dev-tools script to composer.json if not already present
49-
$extra = $composer->getPackage()->getExtra() ?? [];
50-
51-
if (!isset($extra['scripts']['dev-tools'])) {
49+
$extra = $composer->getPackage()
50+
->getExtra() ?? [];
51+
52+
if (! isset($extra['scripts']['dev-tools'])) {
5253
$extra['scripts']['dev-tools'] = 'dev-tools';
53-
$composer->getPackage()->setExtra($extra);
54+
$composer->getPackage()
55+
->setExtra($extra);
5456
}
5557
}
5658

0 commit comments

Comments
 (0)