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

styles: Enable the trailing comma PHP-CS-Fixer rule #1927

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 6 additions & 2 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
'This code is licensed under the BSD 3-Clause License.%s',
\substr(
\file_get_contents('LICENSE'),
\strlen('BSD 3-Clause License')
)
\strlen('BSD 3-Clause License'),
),
));

$finder = Finder::create()
Expand Down Expand Up @@ -160,6 +160,10 @@
'static_lambda' => true,
'strict_comparison' => true,
'strict_param' => true,
'trailing_comma_in_multiline' => [
'after_heredoc' => true,
'elements' => ['arguments', 'arrays', 'match', 'parameters'],
],
'yoda_style' => [
'equal' => false,
'identical' => false,
Expand Down
2 changes: 1 addition & 1 deletion bin/infection
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ You need to set up the project dependencies using Composer:
$ composer install
You can learn all about Composer on https://getcomposer.org/.

ERROR
ERROR,
);

throw new RuntimeException('Unable to find the Composer autoloader.');
Expand Down
4 changes: 2 additions & 2 deletions src/Command/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ final public function getApplication(): Application
$application,
Application::class,
'Cannot access to the command application if the command has not been '
. 'registered to the application yet'
. 'registered to the application yet',
);

return $application;
Expand All @@ -81,7 +81,7 @@ final protected function getIO(): IO
{
Assert::notNull(
$this->io,
'Cannot retrieve the IO object before the command was initialized'
'Cannot retrieve the IO object before the command was initialized',
);

return $this->io;
Expand Down
16 changes: 8 additions & 8 deletions src/Command/ConfigureCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ protected function configure(): void
InputOption::VALUE_REQUIRED,
sprintf(
'Name of the Test framework to use ("%s")',
implode('", "', TestFrameworkTypes::getTypes())
implode('", "', TestFrameworkTypes::getTypes()),
),
TestFrameworkTypes::PHPUNIT
TestFrameworkTypes::PHPUNIT,
);
}

Expand All @@ -110,7 +110,7 @@ protected function executeCommand(IO $io): bool
$consoleHelper = new ConsoleHelper($formatterHelper);
$consoleHelper->writeSection(
$io->getOutput(),
'Welcome to the Infection config generator'
'Welcome to the Infection config generator',
);

$io->newLine();
Expand Down Expand Up @@ -145,7 +145,7 @@ protected function executeCommand(IO $io): bool
$excludeDirsProvider = new ExcludeDirsProvider(
$consoleHelper,
$questionHelper,
$fileSystem
$fileSystem,
);

$excludedDirs = $excludeDirsProvider->get($io, $dirsInCurrentDir, $sourceDirs);
Expand All @@ -154,7 +154,7 @@ protected function executeCommand(IO $io): bool
$phpUnitConfigPath = $phpUnitConfigPathProvider->get(
$io,
$dirsInCurrentDir,
$io->getInput()->getOption(self::OPTION_TEST_FRAMEWORK)
$io->getInput()->getOption(self::OPTION_TEST_FRAMEWORK),
);

$phpUnitExecutableFinder = new TestFrameworkFinder();
Expand All @@ -169,7 +169,7 @@ protected function executeCommand(IO $io): bool
$io->newLine();
$io->writeln(sprintf(
'Configuration file "<comment>%s</comment>" was created.',
SchemaConfigurationLoader::DEFAULT_JSON5_CONFIG_FILE
SchemaConfigurationLoader::DEFAULT_JSON5_CONFIG_FILE,
));
$io->newLine();

Expand All @@ -185,7 +185,7 @@ private function saveConfig(
array $excludedDirs,
?string $phpUnitConfigPath = null,
?string $phpUnitCustomExecutablePath = null,
?string $textLogFilePath = null
?string $textLogFilePath = null,
): void {
$configObject = new stdClass();

Expand Down Expand Up @@ -230,7 +230,7 @@ private function saveConfig(

file_put_contents(
SchemaConfigurationLoader::DEFAULT_JSON5_CONFIG_FILE,
json_encode($configObject, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
json_encode($configObject, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES),
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Command/DescribeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@
$question = new Question('What mutator do you wish to describe?');
$question->setAutocompleterValues(array_keys(ProfileList::ALL_MUTATORS));
$mutator = $io->askQuestion(
$question
$question,
);
}

if (!array_key_exists($mutator, ProfileList::ALL_MUTATORS)) {
$io->error(sprintf(
'"The %s mutator does not exist"',
$mutator
$mutator,
));

return false;
Expand All @@ -90,7 +90,7 @@
if ($definition === null) {
$io->error(sprintf(
'Mutator "%s" does not have a definition',
$mutator
$mutator,
));

return false;
Expand All @@ -103,12 +103,12 @@
$diff = $definition->getDiff();

$diffColorizer = $this->getApplication()->getContainer()->getDiffColorizer();
$io->writeln(

Check warning on line 106 in src/Command/DescribeCommand.php

View workflow job for this annotation

GitHub Actions / Mutation Testing Code Review Annotations 8.1

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ $io->writeln($definition->getDescription()); $diff = $definition->getDiff(); $diffColorizer = $this->getApplication()->getContainer()->getDiffColorizer(); - $io->writeln(['', 'For example:', $diffColorizer->colorize($diff)]); + $remedy = $definition->getRemedies(); if ($remedy !== null) { $io->writeln('');
[

Check warning on line 107 in src/Command/DescribeCommand.php

View workflow job for this annotation

GitHub Actions / Mutation Testing Code Review Annotations 8.1

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ $io->writeln($definition->getDescription()); $diff = $definition->getDiff(); $diffColorizer = $this->getApplication()->getContainer()->getDiffColorizer(); - $io->writeln(['', 'For example:', $diffColorizer->colorize($diff)]); + $io->writeln(['For example:', $diffColorizer->colorize($diff)]); $remedy = $definition->getRemedies(); if ($remedy !== null) { $io->writeln('');
'',
'For example:',
$diffColorizer->colorize($diff),
]
],
);

$remedy = $definition->getRemedies();
Expand Down