@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $attributes = $this->getClassAttributes($class, $name); |
| 50 | 50 | |
| 51 | - foreach ($attributes as $attribute => $arguments) { |
|
| 51 | + foreach ($attributes as $attribute => $arguments){ |
|
| 52 | 52 | yield $this->instantiator->instantiate($attribute, $arguments, $class); |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $attributes = $this->getFunctionAttributes($function, $name); |
| 63 | 63 | |
| 64 | - foreach ($attributes as $attribute => $arguments) { |
|
| 64 | + foreach ($attributes as $attribute => $arguments){ |
|
| 65 | 65 | yield $this->instantiator->instantiate($attribute, $arguments, $function); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $attributes = $this->getPropertyAttributes($property, $name); |
| 76 | 76 | |
| 77 | - foreach ($attributes as $attribute => $arguments) { |
|
| 77 | + foreach ($attributes as $attribute => $arguments){ |
|
| 78 | 78 | yield $this->instantiator->instantiate($attribute, $arguments, $property); |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | { |
| 88 | 88 | $attributes = $this->getConstantAttributes($constant, $name); |
| 89 | 89 | |
| 90 | - foreach ($attributes as $attribute => $arguments) { |
|
| 90 | + foreach ($attributes as $attribute => $arguments){ |
|
| 91 | 91 | yield $this->instantiator->instantiate($attribute, $arguments, $constant); |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | $attributes = $this->getParameterAttributes($parameter, $name); |
| 102 | 102 | |
| 103 | - foreach ($attributes as $attribute => $arguments) { |
|
| 103 | + foreach ($attributes as $attribute => $arguments){ |
|
| 104 | 104 | yield $this->instantiator->instantiate($attribute, $arguments, $parameter); |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | protected function assertClassExists(string $class, \Reflector $context): void |
| 113 | 113 | { |
| 114 | - if (!\class_exists($class)) { |
|
| 114 | + if (!\class_exists($class)){ |
|
| 115 | 115 | $message = \vsprintf('The metadata class "%s" in %s was not found', [ |
| 116 | 116 | $class, |
| 117 | 117 | $this->renderer->render($context), |
@@ -48,7 +48,8 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $attributes = $this->getClassAttributes($class, $name); |
| 50 | 50 | |
| 51 | - foreach ($attributes as $attribute => $arguments) { |
|
| 51 | + foreach ($attributes as $attribute => $arguments) |
|
| 52 | + { |
|
| 52 | 53 | yield $this->instantiator->instantiate($attribute, $arguments, $class); |
| 53 | 54 | } |
| 54 | 55 | } |
@@ -61,7 +62,8 @@ discard block |
||
| 61 | 62 | { |
| 62 | 63 | $attributes = $this->getFunctionAttributes($function, $name); |
| 63 | 64 | |
| 64 | - foreach ($attributes as $attribute => $arguments) { |
|
| 65 | + foreach ($attributes as $attribute => $arguments) |
|
| 66 | + { |
|
| 65 | 67 | yield $this->instantiator->instantiate($attribute, $arguments, $function); |
| 66 | 68 | } |
| 67 | 69 | } |
@@ -74,7 +76,8 @@ discard block |
||
| 74 | 76 | { |
| 75 | 77 | $attributes = $this->getPropertyAttributes($property, $name); |
| 76 | 78 | |
| 77 | - foreach ($attributes as $attribute => $arguments) { |
|
| 79 | + foreach ($attributes as $attribute => $arguments) |
|
| 80 | + { |
|
| 78 | 81 | yield $this->instantiator->instantiate($attribute, $arguments, $property); |
| 79 | 82 | } |
| 80 | 83 | } |
@@ -87,7 +90,8 @@ discard block |
||
| 87 | 90 | { |
| 88 | 91 | $attributes = $this->getConstantAttributes($constant, $name); |
| 89 | 92 | |
| 90 | - foreach ($attributes as $attribute => $arguments) { |
|
| 93 | + foreach ($attributes as $attribute => $arguments) |
|
| 94 | + { |
|
| 91 | 95 | yield $this->instantiator->instantiate($attribute, $arguments, $constant); |
| 92 | 96 | } |
| 93 | 97 | } |
@@ -100,7 +104,8 @@ discard block |
||
| 100 | 104 | { |
| 101 | 105 | $attributes = $this->getParameterAttributes($parameter, $name); |
| 102 | 106 | |
| 103 | - foreach ($attributes as $attribute => $arguments) { |
|
| 107 | + foreach ($attributes as $attribute => $arguments) |
|
| 108 | + { |
|
| 104 | 109 | yield $this->instantiator->instantiate($attribute, $arguments, $parameter); |
| 105 | 110 | } |
| 106 | 111 | } |
@@ -111,7 +116,8 @@ discard block |
||
| 111 | 116 | */ |
| 112 | 117 | protected function assertClassExists(string $class, \Reflector $context): void |
| 113 | 118 | { |
| 114 | - if (!\class_exists($class)) { |
|
| 119 | + if (!\class_exists($class)) |
|
| 120 | + { |
|
| 115 | 121 | $message = \vsprintf('The metadata class "%s" in %s was not found', [ |
| 116 | 122 | $class, |
| 117 | 123 | $this->renderer->render($context), |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function forClass(\ReflectionClass $class): string |
| 57 | 57 | { |
| 58 | - if ($class->isAnonymous()) { |
|
| 58 | + if ($class->isAnonymous()){ |
|
| 59 | 59 | return \vsprintf(self::TPL_ANONYMOUS_CLASS, [ |
| 60 | 60 | $class->getFileName(), |
| 61 | 61 | $class->getStartLine(), |
@@ -104,14 +104,14 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function forFunction(\ReflectionFunctionAbstract $fn): string |
| 106 | 106 | { |
| 107 | - if ($fn instanceof \ReflectionMethod) { |
|
| 107 | + if ($fn instanceof \ReflectionMethod){ |
|
| 108 | 108 | return \vsprintf(self::TPL_METHOD, [ |
| 109 | 109 | $this->forClass($fn->getDeclaringClass()), |
| 110 | 110 | $fn->getName(), |
| 111 | 111 | ]); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if ($fn->isClosure()) { |
|
| 114 | + if ($fn->isClosure()){ |
|
| 115 | 115 | return \vsprintf(self::TPL_ANONYMOUS_FN, [ |
| 116 | 116 | $fn->getFileName(), |
| 117 | 117 | $fn->getStartLine(), |
@@ -55,7 +55,8 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function forClass(\ReflectionClass $class): string |
| 57 | 57 | { |
| 58 | - if ($class->isAnonymous()) { |
|
| 58 | + if ($class->isAnonymous()) |
|
| 59 | + { |
|
| 59 | 60 | return \vsprintf(self::TPL_ANONYMOUS_CLASS, [ |
| 60 | 61 | $class->getFileName(), |
| 61 | 62 | $class->getStartLine(), |
@@ -104,14 +105,16 @@ discard block |
||
| 104 | 105 | */ |
| 105 | 106 | public function forFunction(\ReflectionFunctionAbstract $fn): string |
| 106 | 107 | { |
| 107 | - if ($fn instanceof \ReflectionMethod) { |
|
| 108 | + if ($fn instanceof \ReflectionMethod) |
|
| 109 | + { |
|
| 108 | 110 | return \vsprintf(self::TPL_METHOD, [ |
| 109 | 111 | $this->forClass($fn->getDeclaringClass()), |
| 110 | 112 | $fn->getName(), |
| 111 | 113 | ]); |
| 112 | 114 | } |
| 113 | 115 | |
| 114 | - if ($fn->isClosure()) { |
|
| 116 | + if ($fn->isClosure()) |
|
| 117 | + { |
|
| 115 | 118 | return \vsprintf(self::TPL_ANONYMOUS_FN, [ |
| 116 | 119 | $fn->getFileName(), |
| 117 | 120 | $fn->getStartLine(), |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | { |
| 107 | 107 | $result = []; |
| 108 | 108 | |
| 109 | - foreach ($this->generators as $generator) { |
|
| 109 | + foreach ($this->generators as $generator){ |
|
| 110 | 110 | $result[] = $each($generator); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -106,7 +106,8 @@ |
||
| 106 | 106 | { |
| 107 | 107 | $result = []; |
| 108 | 108 | |
| 109 | - foreach ($this->generators as $generator) { |
|
| 109 | + foreach ($this->generators as $generator) |
|
| 110 | + { |
|
| 110 | 111 | $result[] = $each($generator); |
| 111 | 112 | } |
| 112 | 113 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function forClass(\ReflectionClass $class): string |
| 27 | 27 | { |
| 28 | - if ($class->isUserDefined()) { |
|
| 28 | + if ($class->isUserDefined()){ |
|
| 29 | 29 | return (string)\filemtime( |
| 30 | 30 | $class->getFileName() |
| 31 | 31 | ); |
@@ -61,23 +61,23 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function forFunction(\ReflectionFunctionAbstract $fn): string |
| 63 | 63 | { |
| 64 | - if ($fn instanceof \ReflectionMethod) { |
|
| 64 | + if ($fn instanceof \ReflectionMethod){ |
|
| 65 | 65 | return $this->forClass( |
| 66 | 66 | $fn->getDeclaringClass() |
| 67 | 67 | ); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if ($fn->isUserDefined()) { |
|
| 70 | + if ($fn->isUserDefined()){ |
|
| 71 | 71 | return (string)\filemtime( |
| 72 | 72 | $fn->getFileName() |
| 73 | 73 | ); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if ($extension = $fn->getExtension()) { |
|
| 76 | + if ($extension = $fn->getExtension()){ |
|
| 77 | 77 | return $extension->getVersion(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - throw new \LogicException('Can not determine modification time of [' . $fn->getName() . ']'); |
|
| 80 | + throw new \LogicException('Can not determine modification time of ['.$fn->getName().']'); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -25,7 +25,8 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function forClass(\ReflectionClass $class): string |
| 27 | 27 | { |
| 28 | - if ($class->isUserDefined()) { |
|
| 28 | + if ($class->isUserDefined()) |
|
| 29 | + { |
|
| 29 | 30 | return (string)\filemtime( |
| 30 | 31 | $class->getFileName() |
| 31 | 32 | ); |
@@ -61,19 +62,22 @@ discard block |
||
| 61 | 62 | */ |
| 62 | 63 | public function forFunction(\ReflectionFunctionAbstract $fn): string |
| 63 | 64 | { |
| 64 | - if ($fn instanceof \ReflectionMethod) { |
|
| 65 | + if ($fn instanceof \ReflectionMethod) |
|
| 66 | + { |
|
| 65 | 67 | return $this->forClass( |
| 66 | 68 | $fn->getDeclaringClass() |
| 67 | 69 | ); |
| 68 | 70 | } |
| 69 | 71 | |
| 70 | - if ($fn->isUserDefined()) { |
|
| 72 | + if ($fn->isUserDefined()) |
|
| 73 | + { |
|
| 71 | 74 | return (string)\filemtime( |
| 72 | 75 | $fn->getFileName() |
| 73 | 76 | ); |
| 74 | 77 | } |
| 75 | 78 | |
| 76 | - if ($extension = $fn->getExtension()) { |
|
| 79 | + if ($extension = $fn->getExtension()) |
|
| 80 | + { |
|
| 77 | 81 | return $extension->getVersion(); |
| 78 | 82 | } |
| 79 | 83 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function getFunctionMetadata(\ReflectionFunctionAbstract $function, string $name = null): iterable |
| 58 | 58 | { |
| 59 | - if ($function instanceof \ReflectionMethod) { |
|
| 59 | + if ($function instanceof \ReflectionMethod){ |
|
| 60 | 60 | $result = $this->wrapDoctrineExceptions(function () use ($function) { |
| 61 | 61 | return $this->reader->getMethodAnnotations($function); |
| 62 | 62 | }); |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | private function wrapDoctrineExceptions(\Closure $then): iterable |
| 107 | 107 | { |
| 108 | - try { |
|
| 108 | + try{ |
|
| 109 | 109 | return $then(); |
| 110 | - } catch (AnnotationException $e) { |
|
| 111 | - switch (true) { |
|
| 110 | + }catch (AnnotationException $e){ |
|
| 111 | + switch (true){ |
|
| 112 | 112 | case \str_starts_with($e->getMessage(), '[Syntax Error]'): |
| 113 | 113 | case \str_starts_with($e->getMessage(), '[Type Error]'): |
| 114 | 114 | $class = SyntaxAttributeException::class; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | private function bootAnnotations(): void |
| 134 | 134 | { |
| 135 | 135 | // doctrine/annotations ^1.0 compatibility. |
| 136 | - if (\method_exists(AnnotationRegistry::class, 'registerLoader')) { |
|
| 136 | + if (\method_exists(AnnotationRegistry::class, 'registerLoader')){ |
|
| 137 | 137 | AnnotationRegistry::registerLoader('\\class_exists'); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | private function checkAvailability(): void |
| 145 | 145 | { |
| 146 | - if ($this->isAvailable()) { |
|
| 146 | + if ($this->isAvailable()){ |
|
| 147 | 147 | return; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -44,7 +44,8 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function getClassMetadata(\ReflectionClass $class, string $name = null): iterable |
| 46 | 46 | { |
| 47 | - $result = $this->wrapDoctrineExceptions(function () use ($class) { |
|
| 47 | + $result = $this->wrapDoctrineExceptions(function () use ($class) |
|
| 48 | + { |
|
| 48 | 49 | return $this->reader->getClassAnnotations($class); |
| 49 | 50 | }); |
| 50 | 51 | |
@@ -56,8 +57,10 @@ discard block |
||
| 56 | 57 | */ |
| 57 | 58 | public function getFunctionMetadata(\ReflectionFunctionAbstract $function, string $name = null): iterable |
| 58 | 59 | { |
| 59 | - if ($function instanceof \ReflectionMethod) { |
|
| 60 | - $result = $this->wrapDoctrineExceptions(function () use ($function) { |
|
| 60 | + if ($function instanceof \ReflectionMethod) |
|
| 61 | + { |
|
| 62 | + $result = $this->wrapDoctrineExceptions(function () use ($function) |
|
| 63 | + { |
|
| 61 | 64 | return $this->reader->getMethodAnnotations($function); |
| 62 | 65 | }); |
| 63 | 66 | |
@@ -72,7 +75,8 @@ discard block |
||
| 72 | 75 | */ |
| 73 | 76 | public function getPropertyMetadata(\ReflectionProperty $property, string $name = null): iterable |
| 74 | 77 | { |
| 75 | - $result = $this->wrapDoctrineExceptions(function () use ($property) { |
|
| 78 | + $result = $this->wrapDoctrineExceptions(function () use ($property) |
|
| 79 | + { |
|
| 76 | 80 | return $this->reader->getPropertyAnnotations($property); |
| 77 | 81 | }); |
| 78 | 82 | |
@@ -105,10 +109,14 @@ discard block |
||
| 105 | 109 | |
| 106 | 110 | private function wrapDoctrineExceptions(\Closure $then): iterable |
| 107 | 111 | { |
| 108 | - try { |
|
| 112 | + try |
|
| 113 | + { |
|
| 109 | 114 | return $then(); |
| 110 | - } catch (AnnotationException $e) { |
|
| 111 | - switch (true) { |
|
| 115 | + } |
|
| 116 | + catch (AnnotationException $e) |
|
| 117 | + { |
|
| 118 | + switch (true) |
|
| 119 | + { |
|
| 112 | 120 | case \str_starts_with($e->getMessage(), '[Syntax Error]'): |
| 113 | 121 | case \str_starts_with($e->getMessage(), '[Type Error]'): |
| 114 | 122 | $class = SyntaxAttributeException::class; |
@@ -133,7 +141,8 @@ discard block |
||
| 133 | 141 | private function bootAnnotations(): void |
| 134 | 142 | { |
| 135 | 143 | // doctrine/annotations ^1.0 compatibility. |
| 136 | - if (\method_exists(AnnotationRegistry::class, 'registerLoader')) { |
|
| 144 | + if (\method_exists(AnnotationRegistry::class, 'registerLoader')) |
|
| 145 | + { |
|
| 137 | 146 | AnnotationRegistry::registerLoader('\\class_exists'); |
| 138 | 147 | } |
| 139 | 148 | } |
@@ -143,7 +152,8 @@ discard block |
||
| 143 | 152 | */ |
| 144 | 153 | private function checkAvailability(): void |
| 145 | 154 | { |
| 146 | - if ($this->isAvailable()) { |
|
| 155 | + if ($this->isAvailable()) |
|
| 156 | + { |
|
| 147 | 157 | return; |
| 148 | 158 | } |
| 149 | 159 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | // 1) Can not parse internal classes |
| 98 | 98 | // 2) Anonymous classes don't support attributes (PHP semantic) |
| 99 | - if ($class->isInternal() || $class->isAnonymous()) { |
|
| 99 | + if ($class->isInternal() || $class->isAnonymous()){ |
|
| 100 | 100 | return []; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | protected function getFunctionAttributes(\ReflectionFunctionAbstract $function, ?string $name): iterable |
| 112 | 112 | { |
| 113 | 113 | // Can not parse internal functions |
| 114 | - if ($function->isInternal()) { |
|
| 114 | + if ($function->isInternal()){ |
|
| 115 | 115 | return []; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $class = $property->getDeclaringClass(); |
| 130 | 130 | |
| 131 | 131 | // Can not parse property of internal class |
| 132 | - if ($class->isInternal()) { |
|
| 132 | + if ($class->isInternal()){ |
|
| 133 | 133 | return []; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $class = $const->getDeclaringClass(); |
| 147 | 147 | |
| 148 | 148 | // Can not parse internal classes |
| 149 | - if ($class->isInternal()) { |
|
| 149 | + if ($class->isInternal()){ |
|
| 150 | 150 | return []; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $function = $param->getDeclaringFunction(); |
| 164 | 164 | |
| 165 | 165 | // Can not parse parameter of internal function |
| 166 | - if ($function->isInternal()) { |
|
| 166 | + if ($function->isInternal()){ |
|
| 167 | 167 | return []; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | private function parseAttributes(string $file, int $context): array |
| 184 | 184 | { |
| 185 | - if (!isset($this->attributes[$file])) { |
|
| 185 | + if (!isset($this->attributes[$file])){ |
|
| 186 | 186 | $found = $this->parser->parse($file); |
| 187 | 187 | |
| 188 | 188 | $this->attributes[$file] = [ |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | private function format(iterable $attributes, ?string $name, \Reflector $context): iterable |
| 206 | 206 | { |
| 207 | - foreach ($attributes as $prototype) { |
|
| 208 | - if ($prototype->name !== $name && $name !== null && !\is_subclass_of($prototype->name, $name)) { |
|
| 207 | + foreach ($attributes as $prototype){ |
|
| 208 | + if ($prototype->name !== $name && $name !== null && !\is_subclass_of($prototype->name, $name)){ |
|
| 209 | 209 | continue; |
| 210 | 210 | } |
| 211 | 211 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | $line = $function->getEndLine(); |
| 247 | 247 | |
| 248 | - if ($result = $attributes[$line] ?? null) { |
|
| 248 | + if ($result = $attributes[$line] ?? null){ |
|
| 249 | 249 | return $result; |
| 250 | 250 | } |
| 251 | 251 | |
@@ -270,9 +270,9 @@ discard block |
||
| 270 | 270 | * $ast->getEndLine(); // 2 (last significant character of a function) |
| 271 | 271 | * </code> |
| 272 | 272 | */ |
| 273 | - if ($function->isClosure()) { |
|
| 274 | - while ($line-- > $function->getStartLine()) { |
|
| 275 | - if ($result = $attributes[$line] ?? null) { |
|
| 273 | + if ($function->isClosure()){ |
|
| 274 | + while ($line-- > $function->getStartLine()){ |
|
| 275 | + if ($result = $attributes[$line] ?? null){ |
|
| 276 | 276 | return $result; |
| 277 | 277 | } |
| 278 | 278 | } |
@@ -96,7 +96,8 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | // 1) Can not parse internal classes |
| 98 | 98 | // 2) Anonymous classes don't support attributes (PHP semantic) |
| 99 | - if ($class->isInternal() || $class->isAnonymous()) { |
|
| 99 | + if ($class->isInternal() || $class->isAnonymous()) |
|
| 100 | + { |
|
| 100 | 101 | return []; |
| 101 | 102 | } |
| 102 | 103 | |
@@ -111,7 +112,8 @@ discard block |
||
| 111 | 112 | protected function getFunctionAttributes(\ReflectionFunctionAbstract $function, ?string $name): iterable |
| 112 | 113 | { |
| 113 | 114 | // Can not parse internal functions |
| 114 | - if ($function->isInternal()) { |
|
| 115 | + if ($function->isInternal()) |
|
| 116 | + { |
|
| 115 | 117 | return []; |
| 116 | 118 | } |
| 117 | 119 | |
@@ -129,7 +131,8 @@ discard block |
||
| 129 | 131 | $class = $property->getDeclaringClass(); |
| 130 | 132 | |
| 131 | 133 | // Can not parse property of internal class |
| 132 | - if ($class->isInternal()) { |
|
| 134 | + if ($class->isInternal()) |
|
| 135 | + { |
|
| 133 | 136 | return []; |
| 134 | 137 | } |
| 135 | 138 | |
@@ -146,7 +149,8 @@ discard block |
||
| 146 | 149 | $class = $const->getDeclaringClass(); |
| 147 | 150 | |
| 148 | 151 | // Can not parse internal classes |
| 149 | - if ($class->isInternal()) { |
|
| 152 | + if ($class->isInternal()) |
|
| 153 | + { |
|
| 150 | 154 | return []; |
| 151 | 155 | } |
| 152 | 156 | |
@@ -163,7 +167,8 @@ discard block |
||
| 163 | 167 | $function = $param->getDeclaringFunction(); |
| 164 | 168 | |
| 165 | 169 | // Can not parse parameter of internal function |
| 166 | - if ($function->isInternal()) { |
|
| 170 | + if ($function->isInternal()) |
|
| 171 | + { |
|
| 167 | 172 | return []; |
| 168 | 173 | } |
| 169 | 174 | |
@@ -182,7 +187,8 @@ discard block |
||
| 182 | 187 | */ |
| 183 | 188 | private function parseAttributes(string $file, int $context): array |
| 184 | 189 | { |
| 185 | - if (!isset($this->attributes[$file])) { |
|
| 190 | + if (!isset($this->attributes[$file])) |
|
| 191 | + { |
|
| 186 | 192 | $found = $this->parser->parse($file); |
| 187 | 193 | |
| 188 | 194 | $this->attributes[$file] = [ |
@@ -204,8 +210,10 @@ discard block |
||
| 204 | 210 | */ |
| 205 | 211 | private function format(iterable $attributes, ?string $name, \Reflector $context): iterable |
| 206 | 212 | { |
| 207 | - foreach ($attributes as $prototype) { |
|
| 208 | - if ($prototype->name !== $name && $name !== null && !\is_subclass_of($prototype->name, $name)) { |
|
| 213 | + foreach ($attributes as $prototype) |
|
| 214 | + { |
|
| 215 | + if ($prototype->name !== $name && $name !== null && !\is_subclass_of($prototype->name, $name)) |
|
| 216 | + { |
|
| 209 | 217 | continue; |
| 210 | 218 | } |
| 211 | 219 | |
@@ -245,7 +253,8 @@ discard block |
||
| 245 | 253 | */ |
| 246 | 254 | $line = $function->getEndLine(); |
| 247 | 255 | |
| 248 | - if ($result = $attributes[$line] ?? null) { |
|
| 256 | + if ($result = $attributes[$line] ?? null) |
|
| 257 | + { |
|
| 249 | 258 | return $result; |
| 250 | 259 | } |
| 251 | 260 | |
@@ -270,9 +279,12 @@ discard block |
||
| 270 | 279 | * $ast->getEndLine(); // 2 (last significant character of a function) |
| 271 | 280 | * </code> |
| 272 | 281 | */ |
| 273 | - if ($function->isClosure()) { |
|
| 274 | - while ($line-- > $function->getStartLine()) { |
|
| 275 | - if ($result = $attributes[$line] ?? null) { |
|
| 282 | + if ($function->isClosure()) |
|
| 283 | + { |
|
| 284 | + while ($line-- > $function->getStartLine()) |
|
| 285 | + { |
|
| 286 | + if ($result = $attributes[$line] ?? null) |
|
| 287 | + { |
|
| 276 | 288 | return $result; |
| 277 | 289 | } |
| 278 | 290 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | */ |
| 111 | 111 | private function iterableToArray(iterable $meta): array |
| 112 | 112 | { |
| 113 | - if ($meta instanceof \Traversable) { |
|
| 113 | + if ($meta instanceof \Traversable){ |
|
| 114 | 114 | return \iterator_to_array($meta, false); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -110,7 +110,8 @@ |
||
| 110 | 110 | */ |
| 111 | 111 | private function iterableToArray(iterable $meta): array |
| 112 | 112 | { |
| 113 | - if ($meta instanceof \Traversable) { |
|
| 113 | + if ($meta instanceof \Traversable) |
|
| 114 | + { |
|
| 114 | 115 | return \iterator_to_array($meta, false); |
| 115 | 116 | } |
| 116 | 117 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | private function decorateByAnnotations(ReaderInterface $reader): ReaderInterface |
| 58 | 58 | { |
| 59 | - if (\interface_exists(DoctrineReaderInterface::class)) { |
|
| 59 | + if (\interface_exists(DoctrineReaderInterface::class)){ |
|
| 60 | 60 | $reader = new SelectiveReader([$reader, new DoctrineAnnotationReader()]); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | private function decorateByCache(ReaderInterface $reader): ReaderInterface |
| 71 | 71 | { |
| 72 | - switch (true) { |
|
| 72 | + switch (true){ |
|
| 73 | 73 | case $this->cache instanceof CacheInterface: |
| 74 | 74 | return new Psr16CachedReader($reader, $this->cache); |
| 75 | 75 | |
@@ -56,7 +56,8 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | private function decorateByAnnotations(ReaderInterface $reader): ReaderInterface |
| 58 | 58 | { |
| 59 | - if (\interface_exists(DoctrineReaderInterface::class)) { |
|
| 59 | + if (\interface_exists(DoctrineReaderInterface::class)) |
|
| 60 | + { |
|
| 60 | 61 | $reader = new SelectiveReader([$reader, new DoctrineAnnotationReader()]); |
| 61 | 62 | } |
| 62 | 63 | |
@@ -69,7 +70,8 @@ discard block |
||
| 69 | 70 | */ |
| 70 | 71 | private function decorateByCache(ReaderInterface $reader): ReaderInterface |
| 71 | 72 | { |
| 72 | - switch (true) { |
|
| 73 | + switch (true) |
|
| 74 | + { |
|
| 73 | 75 | case $this->cache instanceof CacheInterface: |
| 74 | 76 | return new Psr16CachedReader($reader, $this->cache); |
| 75 | 77 | |
@@ -22,8 +22,8 @@ |
||
| 22 | 22 | // |
| 23 | 23 | // In this case, it should be loaded explicitly. |
| 24 | 24 | // |
| 25 | -if (!\class_exists(DoctrineNamedArgumentConstructor::class, false)) { |
|
| 26 | - require_once __DIR__ . '/polyfill.php'; |
|
| 25 | +if (!\class_exists(DoctrineNamedArgumentConstructor::class, false)){ |
|
| 26 | + require_once __DIR__.'/polyfill.php'; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -22,7 +22,8 @@ |
||
| 22 | 22 | // |
| 23 | 23 | // In this case, it should be loaded explicitly. |
| 24 | 24 | // |
| 25 | -if (!\class_exists(DoctrineNamedArgumentConstructor::class, false)) { |
|
| 25 | +if (!\class_exists(DoctrineNamedArgumentConstructor::class, false)) |
|
| 26 | +{ |
|
| 26 | 27 | require_once __DIR__ . '/polyfill.php'; |
| 27 | 28 | } |
| 28 | 29 | |