Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeliot-Tm committed Dec 1, 2024
1 parent 6467b0a commit b9463c1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/ApplicationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ private function createRegistrar(Config $config): RegistrarInterface
} else {
$newType = RegistrarType::tryFrom($registrarType);
if (!$newType) {
throw new InvalidConfigException(\sprintf('Invalid type of registrar configured: %s',
$registrarType));
throw new InvalidConfigException(\sprintf('Invalid type of registrar: %s', $registrarType));
}
$registrarType = $newType;
}
Expand Down Expand Up @@ -136,7 +135,7 @@ private function getOutput(array $options): Output
'1', '', 'verbose' => Output::VERBOSITY_VERBOSE,
'0', 'normal', => Output::VERBOSITY_NORMAL,
'-1', => Output::VERBOSITY_QUIET,
default => throw new InvalidOptionException(sprintf('Unexpected value "%s" for verbosity', $verbosity))
default => throw new InvalidOptionException(\sprintf('Unexpected value "%s" for verbosity', $verbosity))
});
}
}
4 changes: 2 additions & 2 deletions src/Console/OptionsReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public function getOptions(): array
}

if (false === $values['verbose']) {

Check failure on line 54 in src/Console/OptionsReader.php

View workflow job for this annotation

GitHub Actions / PHPStan: analyse

Strict comparison using === between false and string|null will always evaluate to false.
if (array_key_exists('verbose', $options)) {
if (\array_key_exists('verbose', $options)) {
$values['verbose'] = '0';
} elseif (array_key_exists('v', $options)) {
} elseif (\array_key_exists('v', $options)) {
$values['verbose'] = '1';
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/Console/Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the TODO Registrar project.
*
* (c) Anatoliy Melnikov <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Aeliot\TodoRegistrar\Console;

/**
Expand Down Expand Up @@ -95,7 +104,6 @@ private function doWrite($stream, string $message, bool $newline): void
fflush($stream);
}


/**
* Returns true if current environment supports writing console output to
* STDOUT.
Expand Down
9 changes: 9 additions & 0 deletions src/Exception/InvalidOptionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the TODO Registrar project.
*
* (c) Anatoliy Melnikov <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Aeliot\TodoRegistrar\Exception;

final class InvalidOptionException extends \InvalidArgumentException
Expand Down

0 comments on commit b9463c1

Please sign in to comment.