Skip to content

Commit

Permalink
chore: reworks coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Apr 30, 2024
1 parent 4d9bc5d commit d19250a
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/Cache/FileStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FileStore implements CacheInterface

private readonly string $directory;

public function __construct(string $directory = null)
public function __construct(?string $directory = null)
{
$this->directory = $directory ?? (sys_get_temp_dir().DIRECTORY_SEPARATOR.self::CACHE_FOLDER_NAME); // @pest-mutate-ignore

Expand All @@ -29,7 +29,7 @@ public function get(string $key, mixed $default = null): mixed
return $this->getPayload($key) ?? $default;
}

public function set(string $key, mixed $value, DateInterval|int $ttl = null): bool
public function set(string $key, mixed $value, DateInterval|int|null $ttl = null): bool
{
$payload = serialize($value);

Expand Down Expand Up @@ -77,7 +77,7 @@ public function getMultiple(iterable $keys, mixed $default = null): iterable
/**
* @param iterable<string, mixed> $values
*/
public function setMultiple(iterable $values, DateInterval|int $ttl = null): bool // @phpstan-ignore-line
public function setMultiple(iterable $values, DateInterval|int|null $ttl = null): bool // @phpstan-ignore-line
{
$result = true;

Expand Down
4 changes: 2 additions & 2 deletions src/Cache/NullStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function get(string $key, mixed $default = null): mixed
return $default;
}

public function set(string $key, mixed $value, DateInterval|int $ttl = null): bool
public function set(string $key, mixed $value, DateInterval|int|null $ttl = null): bool
{
return true;
}
Expand Down Expand Up @@ -42,7 +42,7 @@ public function getMultiple(iterable $keys, mixed $default = null): iterable
/**
* @param iterable<string, mixed> $values
*/
public function setMultiple(iterable $values, DateInterval|int $ttl = null): bool // @phpstan-ignore-line
public function setMultiple(iterable $values, DateInterval|int|null $ttl = null): bool // @phpstan-ignore-line
{
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Contracts/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public function mutator(array|string ...$mutators): self;
*/
public function except(array|string ...$mutators): self;

public function min(float $minScore, bool $failOnZeroMutations = null): self;
public function min(float $minScore, ?bool $failOnZeroMutations = null): self;

public function ignoreMinScoreOnZeroMutations(bool $ignore = true): self;

public function coveredOnly(bool $coveredOnly = true): self;

public function parallel(bool $parallel = true): self;

public function processes(int $processes = null): self;
public function processes(?int $processes = null): self;

public function profile(bool $profile = true): self;

Expand Down
4 changes: 2 additions & 2 deletions src/Decorators/TestCallDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function coveredOnly(bool $coveredOnly = true): self
return $this;
}

public function min(float $minScore, bool $failOnZeroMutations = null): self
public function min(float $minScore, ?bool $failOnZeroMutations = null): self
{
$this->configuration->min($minScore);
if ($failOnZeroMutations !== null) {
Expand Down Expand Up @@ -129,7 +129,7 @@ public function parallel(bool $parallel = true): self
return $this;
}

public function processes(int $processes = null): Configuration
public function processes(?int $processes = null): Configuration
{
$this->configuration->processes($processes);

Expand Down
12 changes: 6 additions & 6 deletions src/Mutation.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
class Mutation
{
private const TMP_FOLDER = __DIR__
.DIRECTORY_SEPARATOR
.'..'
.DIRECTORY_SEPARATOR
.'.temp'
.DIRECTORY_SEPARATOR
.'mutations';
.DIRECTORY_SEPARATOR
.'..'
.DIRECTORY_SEPARATOR
.'.temp'
.DIRECTORY_SEPARATOR
.'mutations';

private const DIFF_SEPARATOR = '--- Expected'.PHP_EOL.'+++ Actual'.PHP_EOL.'@@ @@'.PHP_EOL;

Expand Down
2 changes: 1 addition & 1 deletion src/MutationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function updateResult(MutationTestResult $result): void
* @param array<string, array<int, array<int, string>>> $coveredLines
* @param array<int, string> $originalArguments
*/
public function start(array $coveredLines, Configuration $configuration, array $originalArguments, int $processId = null): bool
public function start(array $coveredLines, Configuration $configuration, array $originalArguments, ?int $processId = null): bool
{
// TODO: we should pass the tests to run in another way, maybe via cache, mutation or env variable
$filters = [];
Expand Down
4 changes: 2 additions & 2 deletions src/Repositories/ConfigurationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function setProfile(string $profile): void
$this->profile = $profile;
}

public function globalConfiguration(string $name = null): GlobalConfiguration
public function globalConfiguration(?string $name = null): GlobalConfiguration
{
$name ??= $this->profile;

Expand All @@ -64,7 +64,7 @@ public function globalConfiguration(string $name = null): GlobalConfiguration
return $this->globalConfigurations[$name];
}

public function fakeTestConfiguration(string $name = null): TestConfiguration
public function fakeTestConfiguration(?string $name = null): TestConfiguration
{
$name ??= $this->profile;

Expand Down
4 changes: 2 additions & 2 deletions src/Support/Configuration/AbstractConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function except(array|string ...$mutators): self
return $this;
}

public function min(float $minScore, bool $failOnZeroMutations = null): self
public function min(float $minScore, ?bool $failOnZeroMutations = null): self
{
$this->minScore = $minScore;

Expand Down Expand Up @@ -132,7 +132,7 @@ public function parallel(bool $parallel = true): self
return $this;
}

public function processes(int $processes = null): self
public function processes(?int $processes = null): self
{
$this->processes = $processes;

Expand Down

0 comments on commit d19250a

Please sign in to comment.