@@ -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 | /** |
@@ -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 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | /** |
93 | 93 | * Is $actual greater than $expected? |
94 | 94 | */ |
95 | - protected function assertGreaterThan(int|float $expected, int|float $actual): void |
|
95 | + protected function assertGreaterThan(int | float $expected, int | float $actual): void |
|
96 | 96 | { |
97 | 97 | $success = ($actual > $expected); |
98 | 98 | $message = ($success) ? "" : "$actual is not greater than $expected."; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * Is $actual less than $expected? |
104 | 104 | */ |
105 | - protected function assertLessThan(int|float $expected, int|float $actual): void |
|
105 | + protected function assertLessThan(int | float $expected, int | float $actual): void |
|
106 | 106 | { |
107 | 107 | $success = ($actual < $expected); |
108 | 108 | $message = ($success) ? "" : "$actual is not less than $expected."; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | /** |
173 | 173 | * Does $actual contain $needle? |
174 | 174 | */ |
175 | - protected function assertContains(string|array $needle, string|array $actual): void |
|
175 | + protected function assertContains(string | array $needle, string | array $actual): void |
|
176 | 176 | { |
177 | 177 | if (is_string($actual) && is_string($needle)) { |
178 | 178 | $success = ($needle !== "" && str_contains($actual, $needle)); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | /** |
194 | 194 | * Does $actual not contain $needle? |
195 | 195 | */ |
196 | - protected function assertNotContains(string|array $needle, string|array $actual): void |
|
196 | + protected function assertNotContains(string | array $needle, string | array $actual): void |
|
197 | 197 | { |
198 | 198 | if (is_string($actual) && is_string($needle)) { |
199 | 199 | $success = ($needle === "" || !str_contains($actual, $needle)); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | /** |
212 | 212 | * Does $value contain $count items? |
213 | 213 | */ |
214 | - protected function assertCount(int $count, string|array|\Countable $value): void |
|
214 | + protected function assertCount(int $count, string | array | \Countable $value): void |
|
215 | 215 | { |
216 | 216 | if (!is_array($value) && !$value instanceof \Countable) { |
217 | 217 | $this->testResult("The variable is not array or countable object.", false); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | /** |
227 | 227 | * Does $value not contain $count items? |
228 | 228 | */ |
229 | - protected function assertNotCount(int $count, string|array|\Countable $value): void |
|
229 | + protected function assertNotCount(int $count, string | array | \Countable $value): void |
|
230 | 230 | { |
231 | 231 | if (!is_array($value) && !$value instanceof \Countable) { |
232 | 232 | $this->testResult("The variable is not array or countable object.", false); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | /** |
242 | 242 | * Is $value of type $type? |
243 | 243 | */ |
244 | - protected function assertType(string|object $type, mixed $value): void |
|
244 | + protected function assertType(string | object $type, mixed $value): void |
|
245 | 245 | { |
246 | 246 | if ( |
247 | 247 | in_array($type, [ |
@@ -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 | } |
@@ -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 | } |
@@ -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); |
@@ -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); |
@@ -109,7 +109,7 @@ |
||
109 | 109 | /** |
110 | 110 | * Get name for a job |
111 | 111 | */ |
112 | - protected function getJobName(string|object $class, string $method): string |
|
112 | + protected function getJobName(string | object $class, string $method): string |
|
113 | 113 | { |
114 | 114 | $annotation = $this->annotationsReader->getAnnotation(static::ANNOTATION_TEST, $class, $method); |
115 | 115 | if ($annotation !== null) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** @var callable Task */ |
22 | 22 | protected $callback; |
23 | 23 | public readonly array $params; |
24 | - public readonly bool|string $skip; |
|
24 | + public readonly bool | string $skip; |
|
25 | 25 | protected JobResult $result = JobResult::PASSED; |
26 | 26 | protected string $output = ""; |
27 | 27 | /** @var callable[] */ |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | string $name, |
32 | 32 | callable $callback, |
33 | 33 | array $params = [], |
34 | - bool|string $skip = false, |
|
34 | + bool | string $skip = false, |
|
35 | 35 | array $onAfterExecute = [] |
36 | 36 | ) { |
37 | 37 | $this->name = $name; |
@@ -25,9 +25,9 @@ |
||
25 | 25 | $this->suites = $suites; |
26 | 26 | } |
27 | 27 | |
28 | - /** |
|
29 | - * @param class-string $className |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @param class-string $className |
|
30 | + */ |
|
31 | 31 | public function create(string $className): TestCase |
32 | 32 | { |
33 | 33 | foreach ($this->suites as $suite) { |