mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 17:27:22 +01:00
Code quality improvements
This commit is contained in:
@ -40,7 +40,7 @@ final class Coverage implements AddsOutput, HandlesArguments
|
||||
/**
|
||||
* Creates a new Plugin instance.
|
||||
*/
|
||||
public function __construct(private OutputInterface $output)
|
||||
public function __construct(private readonly OutputInterface $output)
|
||||
{
|
||||
// ..
|
||||
}
|
||||
@ -52,7 +52,10 @@ final class Coverage implements AddsOutput, HandlesArguments
|
||||
{
|
||||
$arguments = [...[''], ...array_values(array_filter($originals, function ($original): bool {
|
||||
foreach ([self::COVERAGE_OPTION, self::MIN_OPTION] as $option) {
|
||||
if ($original === sprintf('--%s', $option) || Str::startsWith($original, sprintf('--%s=', $option))) {
|
||||
if ($original === sprintf('--%s', $option)) {
|
||||
return true;
|
||||
}
|
||||
if (Str::startsWith($original, sprintf('--%s=', $option))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,8 +32,8 @@ final class Init implements HandlesArguments
|
||||
* Creates a new Plugin instance.
|
||||
*/
|
||||
public function __construct(
|
||||
private TestSuite $testSuite,
|
||||
private OutputInterface $output
|
||||
private readonly TestSuite $testSuite,
|
||||
private readonly OutputInterface $output
|
||||
) {
|
||||
// ..
|
||||
}
|
||||
@ -43,10 +43,12 @@ final class Init implements HandlesArguments
|
||||
*/
|
||||
public function handleArguments(array $arguments): array
|
||||
{
|
||||
if (! array_key_exists(1, $arguments) || $arguments[1] !== self::INIT_OPTION) {
|
||||
if (! array_key_exists(1, $arguments)) {
|
||||
return $arguments;
|
||||
}
|
||||
if ($arguments[1] !== self::INIT_OPTION) {
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
unset($arguments[1]);
|
||||
|
||||
$this->init();
|
||||
|
||||
@ -24,7 +24,7 @@ final class Memory implements AddsOutput, HandlesArguments
|
||||
* Creates a new Plugin instance.
|
||||
*/
|
||||
public function __construct(
|
||||
private OutputInterface $output
|
||||
private readonly OutputInterface $output
|
||||
) {
|
||||
// ..
|
||||
}
|
||||
@ -47,7 +47,7 @@ final class Memory implements AddsOutput, HandlesArguments
|
||||
if ($this->enabled) {
|
||||
$this->output->writeln(sprintf(
|
||||
' <fg=gray;options=bold>Memory:</> <fg=default>%s MB</>',
|
||||
round(memory_get_usage(true) / pow(1000, 2), 3)
|
||||
round(memory_get_usage(true) / 1000 ** 2, 3)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ final class Version implements HandlesArguments
|
||||
* Creates a new Plugin instance.
|
||||
*/
|
||||
public function __construct(
|
||||
private OutputInterface $output
|
||||
private readonly OutputInterface $output
|
||||
) {
|
||||
// ..
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user