@@ -22,7 +22,7 @@ |
||
22 | 22 | if ($success) { |
23 | 23 | return; |
24 | 24 | } |
25 | - echo "Test $this->taskCount failed. $text\n"; |
|
25 | + echo "test $this->taskCount failed. $text\n"; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -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, [ |
@@ -130,7 +130,7 @@ |
||
130 | 130 | if ($skipped->reason) { |
131 | 131 | $reason = ": {$skipped->reason}"; |
132 | 132 | } |
133 | - echo "Skipped $skipped->name$reason\n"; |
|
133 | + echo "skipped $skipped->name$reason\n"; |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 |
@@ -42,15 +42,15 @@ |
||
42 | 42 | try { |
43 | 43 | $reflection = new ReflectionMethod($class, $dataProvider); |
44 | 44 | if (!$reflection->isPublic()) { |
45 | - throw new InvalidDataProviderException("Method $className::$dataProvider is not public."); |
|
45 | + throw new InvalidDataProviderException("method $className::$dataProvider is not public."); |
|
46 | 46 | } |
47 | 47 | $result = call_user_func([$class, $dataProvider]); |
48 | 48 | if (!is_array($result)) { |
49 | - throw new InvalidDataProviderException("Method $className::$dataProvider has to return an array."); |
|
49 | + throw new InvalidDataProviderException("method $className::$dataProvider has to return an array."); |
|
50 | 50 | } |
51 | 51 | return $result; |
52 | 52 | } catch (\ReflectionException $e) { |
53 | - throw new InvalidDataProviderException("Method $className::$dataProvider does not exist.", 0, $e); |
|
53 | + throw new InvalidDataProviderException("method $className::$dataProvider does not exist.", 0, $e); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | return []; |
@@ -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) { |
@@ -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); |