diff --git a/src/Cache/FileStore.php b/src/Cache/FileStore.php index 9713fde..41efd29 100644 --- a/src/Cache/FileStore.php +++ b/src/Cache/FileStore.php @@ -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 @@ -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); @@ -77,7 +77,7 @@ public function getMultiple(iterable $keys, mixed $default = null): iterable /** * @param iterable $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; diff --git a/src/Cache/NullStore.php b/src/Cache/NullStore.php index 0010924..7d574ec 100644 --- a/src/Cache/NullStore.php +++ b/src/Cache/NullStore.php @@ -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; } @@ -42,7 +42,7 @@ public function getMultiple(iterable $keys, mixed $default = null): iterable /** * @param iterable $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; } diff --git a/src/Contracts/Configuration.php b/src/Contracts/Configuration.php index a230fa6..bb39842 100644 --- a/src/Contracts/Configuration.php +++ b/src/Contracts/Configuration.php @@ -26,7 +26,7 @@ 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; @@ -34,7 +34,7 @@ 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; diff --git a/src/Decorators/TestCallDecorator.php b/src/Decorators/TestCallDecorator.php index ba7078d..797497f 100644 --- a/src/Decorators/TestCallDecorator.php +++ b/src/Decorators/TestCallDecorator.php @@ -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) { @@ -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); diff --git a/src/Mutation.php b/src/Mutation.php index 548755d..a37c1e9 100644 --- a/src/Mutation.php +++ b/src/Mutation.php @@ -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; diff --git a/src/MutationTest.php b/src/MutationTest.php index 49fa355..06765d8 100644 --- a/src/MutationTest.php +++ b/src/MutationTest.php @@ -47,7 +47,7 @@ public function updateResult(MutationTestResult $result): void * @param array>> $coveredLines * @param array $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 = []; diff --git a/src/Repositories/ConfigurationRepository.php b/src/Repositories/ConfigurationRepository.php index fdf4f5c..265a03d 100644 --- a/src/Repositories/ConfigurationRepository.php +++ b/src/Repositories/ConfigurationRepository.php @@ -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; @@ -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; diff --git a/src/Support/Configuration/AbstractConfiguration.php b/src/Support/Configuration/AbstractConfiguration.php index 3025083..70ead13 100644 --- a/src/Support/Configuration/AbstractConfiguration.php +++ b/src/Support/Configuration/AbstractConfiguration.php @@ -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; @@ -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;