@@ -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 | } |
@@ -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, [ |
@@ -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 | } |
@@ -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); |
@@ -21,9 +21,9 @@ |
||
| 21 | 21 | $this->container = $container; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @param class-string $className |
|
| 26 | - */ |
|
| 24 | + /** |
|
| 25 | + * @param class-string $className |
|
| 26 | + */ |
|
| 27 | 27 | public function create(string $className): TestCase |
| 28 | 28 | { |
| 29 | 29 | $suit = $this->container->getByType($className); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * @throws ReflectionException |
| 23 | 23 | */ |
| 24 | - public function hasAnnotation(string $name, string|object $class, string $method = null): bool |
|
| 24 | + public function hasAnnotation(string $name, string | object $class, string $method = null): bool |
|
| 25 | 25 | { |
| 26 | 26 | return count($this->getReflection($class, $method)->getAttributes($this->getClassName($name))) > 0; |
| 27 | 27 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @throws ReflectionException |
| 31 | 31 | */ |
| 32 | - public function getAnnotation(string $name, string|object $class, string $method = null): mixed |
|
| 32 | + public function getAnnotation(string $name, string | object $class, string $method = null): mixed |
|
| 33 | 33 | { |
| 34 | 34 | $attributes = $this->getReflection($class, $method)->getAttributes($this->getClassName($name)); |
| 35 | 35 | if (count($attributes) === 0) { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * @throws ReflectionException |
| 50 | 50 | */ |
| 51 | - private function getReflection(string|object $class, string $method = null): ReflectionClass|ReflectionMethod |
|
| 51 | + private function getReflection(string | object $class, string $method = null): ReflectionClass | ReflectionMethod |
|
| 52 | 52 | { |
| 53 | 53 | if ($method !== null) { |
| 54 | 54 | $reflection = new ReflectionMethod(is_object($class) ? get_class($class) : $class, $method); |