@@ -11,12 +11,12 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | final class DummyEngine implements \MyTester\IAnnotationsReaderEngine |
| 13 | 13 | { |
| 14 | - public function hasAnnotation(string $name, string|object $class, string $method = null): bool |
|
| 14 | + public function hasAnnotation(string $name, string | object $class, string $method = null): bool |
|
| 15 | 15 | { |
| 16 | 16 | return true; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function getAnnotation(string $name, string|object $class, string $method = null): mixed |
|
| 19 | + public function getAnnotation(string $name, string | object $class, string $method = null): mixed |
|
| 20 | 20 | { |
| 21 | 21 | return "abc"; |
| 22 | 22 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | /** @var callable Task */ |
| 29 | 29 | protected $callback; |
| 30 | 30 | protected array $params = []; |
| 31 | - protected bool|string $skip; |
|
| 31 | + protected bool | string $skip; |
|
| 32 | 32 | protected bool $shouldFail; |
| 33 | 33 | protected string $result = self::RESULT_PASSED; |
| 34 | 34 | protected string $output = ""; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | string $name, |
| 38 | 38 | callable $callback, |
| 39 | 39 | array $params = [], |
| 40 | - bool|string $skip = false, |
|
| 40 | + bool | string $skip = false, |
|
| 41 | 41 | bool $shouldFail = false |
| 42 | 42 | ) { |
| 43 | 43 | $this->name = $name; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | return $this->params; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - protected function getSkip(): bool|string |
|
| 65 | + protected function getSkip(): bool | string |
|
| 66 | 66 | { |
| 67 | 67 | return $this->skip; |
| 68 | 68 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | interface IAnnotationsReaderEngine |
| 12 | 12 | { |
| 13 | - public function hasAnnotation(string $name, string|object $class, string $method = null): bool; |
|
| 13 | + public function hasAnnotation(string $name, string | object $class, string $method = null): bool; |
|
| 14 | 14 | |
| 15 | - public function getAnnotation(string $name, string|object $class, string $method = null): mixed; |
|
| 15 | + public function getAnnotation(string $name, string | object $class, string $method = null): mixed; |
|
| 16 | 16 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | /** |
| 50 | 50 | * Check whether to skip a test method |
| 51 | 51 | */ |
| 52 | - public function shouldSkip(string $class, string $method): bool|string |
|
| 52 | + public function shouldSkip(string $class, string $method): bool | string |
|
| 53 | 53 | { |
| 54 | 54 | $value = $this->getSkipValue($class, $method); |
| 55 | 55 | if ($value === null) { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | return $this->taskCount; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - protected function showStringOrArray(string|array $variable): string |
|
| 56 | + protected function showStringOrArray(string | array $variable): string |
|
| 57 | 57 | { |
| 58 | 58 | return (is_string($variable) ? $variable : "(array)"); |
| 59 | 59 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | /** |
| 163 | 163 | * Does $actual contain $needle? |
| 164 | 164 | */ |
| 165 | - protected function assertContains(string|array $needle, string|array $actual): void |
|
| 165 | + protected function assertContains(string | array $needle, string | array $actual): void |
|
| 166 | 166 | { |
| 167 | 167 | if (is_string($actual) && is_string($needle)) { |
| 168 | 168 | $success = $this->isSuccess($needle !== "" && str_contains($actual, $needle)); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | /** |
| 184 | 184 | * Does $actual not contain $needle? |
| 185 | 185 | */ |
| 186 | - protected function assertNotContains(string|array $needle, string|array $actual): void |
|
| 186 | + protected function assertNotContains(string | array $needle, string | array $actual): void |
|
| 187 | 187 | { |
| 188 | 188 | if (is_string($actual) && is_string($needle)) { |
| 189 | 189 | $success = $this->isSuccess($needle === "" || strpos($actual, $needle) === false); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | /** |
| 202 | 202 | * Does $value contain $count items? |
| 203 | 203 | */ |
| 204 | - protected function assertCount(int $count, string|array|\Countable $value): void |
|
| 204 | + protected function assertCount(int $count, string | array | \Countable $value): void |
|
| 205 | 205 | { |
| 206 | 206 | if (!is_array($value) && !$value instanceof \Countable) { |
| 207 | 207 | $this->testResult("The variable is not array or countable object.", false); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | /** |
| 217 | 217 | * Does $value not contain $count items? |
| 218 | 218 | */ |
| 219 | - protected function assertNotCount(int $count, string|array|\Countable $value): void |
|
| 219 | + protected function assertNotCount(int $count, string | array | \Countable $value): void |
|
| 220 | 220 | { |
| 221 | 221 | if (!is_array($value) && !$value instanceof \Countable) { |
| 222 | 222 | $this->testResult("The variable is not array or countable object.", false); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | /** |
| 232 | 232 | * Is $value of type $type? |
| 233 | 233 | */ |
| 234 | - protected function assertType(string|object $type, mixed $value): void |
|
| 234 | + protected function assertType(string | object $type, mixed $value): void |
|
| 235 | 235 | { |
| 236 | 236 | if ( |
| 237 | 237 | in_array($type, [ |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | final class PhpAttributesEngine implements \MyTester\IAnnotationsReaderEngine |
| 20 | 20 | { |
| 21 | - public function hasAnnotation(string $name, string|object $class, string $method = null): bool |
|
| 21 | + public function hasAnnotation(string $name, string | object $class, string $method = null): bool |
|
| 22 | 22 | { |
| 23 | 23 | return count($this->getReflection($class, $method)->getAttributes($this->getClassName($name))) > 0; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function getAnnotation(string $name, string|object $class, string $method = null): mixed |
|
| 26 | + public function getAnnotation(string $name, string | object $class, string $method = null): mixed |
|
| 27 | 27 | { |
| 28 | 28 | $attributes = $this->getReflection($class, $method)->getAttributes($this->getClassName($name)); |
| 29 | 29 | if (count($attributes) === 0) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * @throws ReflectionException |
| 44 | 44 | */ |
| 45 | - private function getReflection(string|object $class, string $method = null): ReflectionClass|ReflectionMethod |
|
| 45 | + private function getReflection(string | object $class, string $method = null): ReflectionClass | ReflectionMethod |
|
| 46 | 46 | { |
| 47 | 47 | if ($method !== null) { |
| 48 | 48 | $reflection = new ReflectionMethod(is_object($class) ? get_class($class) : $class, $method); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $this->engines[] = $engine; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function hasAnnotation(string $name, string|object $class, string $method = null): bool |
|
| 25 | + public function hasAnnotation(string $name, string | object $class, string $method = null): bool |
|
| 26 | 26 | { |
| 27 | 27 | foreach ($this->engines as $engine) { |
| 28 | 28 | if ($engine->hasAnnotation($name, $class, $method)) { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | return false; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function getAnnotation(string $name, string|object $class, string $method = null): mixed |
|
| 35 | + public function getAnnotation(string $name, string | object $class, string $method = null): mixed |
|
| 36 | 36 | { |
| 37 | 37 | foreach ($this->engines as $engine) { |
| 38 | 38 | $value = $engine->getAnnotation($name, $class, $method); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * Get name for a job |
| 104 | 104 | */ |
| 105 | - protected function getJobName(string|object $class, string $method): string |
|
| 105 | + protected function getJobName(string | object $class, string $method): string |
|
| 106 | 106 | { |
| 107 | 107 | $annotation = $this->annotationsReader->getAnnotation(static::ANNOTATION_TEST, $class, $method); |
| 108 | 108 | if ($annotation !== null) { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | $this->shouldFail = false; |
| 154 | 154 | $this->resetCounter(); |
| 155 | - return match ($job->result) { |
|
| 155 | + return match($job->result) { |
|
| 156 | 156 | Job::RESULT_PASSED => static::RESULT_PASSED, |
| 157 | 157 | Job::RESULT_SKIPPED => static::RESULT_SKIPPED, |
| 158 | 158 | Job::RESULT_FAILED => static::RESULT_FAILED, |