@@ -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 | } |
@@ -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) { |
@@ -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); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | return $this->taskCount; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - protected function showStringOrArray(string|array $variable): string |
|
| 54 | + protected function showStringOrArray(string | array $variable): string |
|
| 55 | 55 | { |
| 56 | 56 | return (is_string($variable) ? $variable : "(array)"); |
| 57 | 57 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | /** |
| 153 | 153 | * Does $actual contain $needle? |
| 154 | 154 | */ |
| 155 | - protected function assertContains(string|array $needle, string|array $actual): void |
|
| 155 | + protected function assertContains(string | array $needle, string | array $actual): void |
|
| 156 | 156 | { |
| 157 | 157 | if (is_string($actual) && is_string($needle)) { |
| 158 | 158 | $success = ($needle !== "" && str_contains($actual, $needle)); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | /** |
| 174 | 174 | * Does $actual not contain $needle? |
| 175 | 175 | */ |
| 176 | - protected function assertNotContains(string|array $needle, string|array $actual): void |
|
| 176 | + protected function assertNotContains(string | array $needle, string | array $actual): void |
|
| 177 | 177 | { |
| 178 | 178 | if (is_string($actual) && is_string($needle)) { |
| 179 | 179 | $success = ($needle === "" || !str_contains($actual, $needle)); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | /** |
| 192 | 192 | * Does $value contain $count items? |
| 193 | 193 | */ |
| 194 | - protected function assertCount(int $count, string|array|\Countable $value): void |
|
| 194 | + protected function assertCount(int $count, string | array | \Countable $value): void |
|
| 195 | 195 | { |
| 196 | 196 | if (!is_array($value) && !$value instanceof \Countable) { |
| 197 | 197 | $this->testResult("The variable is not array or countable object.", false); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | /** |
| 207 | 207 | * Does $value not contain $count items? |
| 208 | 208 | */ |
| 209 | - protected function assertNotCount(int $count, string|array|\Countable $value): void |
|
| 209 | + protected function assertNotCount(int $count, string | array | \Countable $value): void |
|
| 210 | 210 | { |
| 211 | 211 | if (!is_array($value) && !$value instanceof \Countable) { |
| 212 | 212 | $this->testResult("The variable is not array or countable object.", false); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | /** |
| 222 | 222 | * Is $value of type $type? |
| 223 | 223 | */ |
| 224 | - protected function assertType(string|object $type, mixed $value): void |
|
| 224 | + protected function assertType(string | object $type, mixed $value): void |
|
| 225 | 225 | { |
| 226 | 226 | if ( |
| 227 | 227 | in_array($type, [ |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | /** |
| 102 | 102 | * Get name for a job |
| 103 | 103 | */ |
| 104 | - protected function getJobName(string|object $class, string $method): string |
|
| 104 | + protected function getJobName(string | object $class, string $method): string |
|
| 105 | 105 | { |
| 106 | 106 | $annotation = $this->annotationsReader->getAnnotation(static::ANNOTATION_TEST, $class, $method); |
| 107 | 107 | if ($annotation !== null) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $this->tearDown(); |
| 150 | 150 | } |
| 151 | 151 | $this->resetCounter(); |
| 152 | - return match ($job->result) { |
|
| 152 | + return match($job->result) { |
|
| 153 | 153 | Job::RESULT_PASSED => static::RESULT_PASSED, |
| 154 | 154 | Job::RESULT_SKIPPED => static::RESULT_SKIPPED, |
| 155 | 155 | Job::RESULT_FAILED => static::RESULT_FAILED, |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * @param class-string|object $class |
| 23 | 23 | * @throws ReflectionException |
| 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 | return count($this->getReflection($class, $method)->getAttributes($this->getClassName($name))) > 0; |
| 28 | 28 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param class-string|object $class |
| 32 | 32 | * @throws ReflectionException |
| 33 | 33 | */ |
| 34 | - public function getAnnotation(string $name, string|object $class, string $method = null): mixed |
|
| 34 | + public function getAnnotation(string $name, string | object $class, string $method = null): mixed |
|
| 35 | 35 | { |
| 36 | 36 | $attributes = $this->getReflection($class, $method)->getAttributes($this->getClassName($name)); |
| 37 | 37 | if (count($attributes) === 0) { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @param class-string|object $class |
| 52 | 52 | * @throws ReflectionException |
| 53 | 53 | */ |
| 54 | - private function getReflection(string|object $class, string $method = null): ReflectionClass|ReflectionMethod |
|
| 54 | + private function getReflection(string | object $class, string $method = null): ReflectionClass | ReflectionMethod |
|
| 55 | 55 | { |
| 56 | 56 | if ($method !== null) { |
| 57 | 57 | $reflection = new ReflectionMethod(is_object($class) ? get_class($class) : $class, $method); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | /** @var callable Task */ |
| 30 | 30 | protected $callback; |
| 31 | 31 | protected array $params = []; |
| 32 | - protected bool|string $skip; |
|
| 32 | + protected bool | string $skip; |
|
| 33 | 33 | protected string $result = self::RESULT_PASSED; |
| 34 | 34 | protected string $output = ""; |
| 35 | 35 | /** @var callable[] */ |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | string $name, |
| 40 | 40 | callable $callback, |
| 41 | 41 | array $params = [], |
| 42 | - bool|string $skip = false, |
|
| 42 | + bool | string $skip = false, |
|
| 43 | 43 | array $onAfterExecute = [] |
| 44 | 44 | ) { |
| 45 | 45 | $this->name = $name; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | return $this->params; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - protected function getSkip(): bool|string |
|
| 67 | + protected function getSkip(): bool | string |
|
| 68 | 68 | { |
| 69 | 69 | return $this->skip; |
| 70 | 70 | } |