@@ -26,14 +26,14 @@ |
||
26 | 26 | public function setUp(): void |
27 | 27 | { |
28 | 28 | $this->app = App::init([ |
29 | - 'root' => __DIR__ . '/App', |
|
30 | - 'app' => __DIR__ . '/App' |
|
29 | + 'root' => __DIR__.'/App', |
|
30 | + 'app' => __DIR__.'/App' |
|
31 | 31 | ]); |
32 | 32 | } |
33 | 33 | |
34 | 34 | public function tearDown(): void |
35 | 35 | { |
36 | - foreach (glob(__DIR__ . '/App/runtime/cache/views/*.php') as $file) { |
|
36 | + foreach (glob(__DIR__.'/App/runtime/cache/views/*.php') as $file){ |
|
37 | 37 | @unlink($file); |
38 | 38 | } |
39 | 39 | } |
@@ -33,7 +33,8 @@ |
||
33 | 33 | |
34 | 34 | public function tearDown(): void |
35 | 35 | { |
36 | - foreach (glob(__DIR__ . '/App/runtime/cache/views/*.php') as $file) { |
|
36 | + foreach (glob(__DIR__ . '/App/runtime/cache/views/*.php') as $file) |
|
37 | + { |
|
37 | 38 | @unlink($file); |
38 | 39 | } |
39 | 40 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | ReaderInterface $reader, |
33 | 33 | CacheItemPoolInterface $cache, |
34 | 34 | KeyGeneratorInterface $generator = null |
35 | - ) { |
|
35 | + ){ |
|
36 | 36 | $this->cache = $cache; |
37 | 37 | |
38 | 38 | parent::__construct($reader, $generator); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $item = $this->cache->getItem($key); |
48 | 48 | |
49 | - if (!$item->isHit()) { |
|
49 | + if (!$item->isHit()){ |
|
50 | 50 | $this->cache->save( |
51 | 51 | $item->set($then()) |
52 | 52 | ); |
@@ -46,7 +46,8 @@ |
||
46 | 46 | { |
47 | 47 | $item = $this->cache->getItem($key); |
48 | 48 | |
49 | - if (!$item->isHit()) { |
|
49 | + if (!$item->isHit()) |
|
50 | + { |
|
50 | 51 | $this->cache->save( |
51 | 52 | $item->set($then()) |
52 | 53 | ); |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | protected function cached(string $key, callable $then): iterable |
43 | 43 | { |
44 | - if (!$this->cache->has($key)) { |
|
44 | + if (!$this->cache->has($key)){ |
|
45 | 45 | $this->cache->set($key, $then()); |
46 | 46 | } |
47 | 47 |
@@ -41,7 +41,8 @@ |
||
41 | 41 | */ |
42 | 42 | protected function cached(string $key, callable $then): iterable |
43 | 43 | { |
44 | - if (!$this->cache->has($key)) { |
|
44 | + if (!$this->cache->has($key)) |
|
45 | + { |
|
45 | 46 | $this->cache->set($key, $then()); |
46 | 47 | } |
47 | 48 |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function instantiate(\ReflectionClass $attr, array $arguments, \Reflector $context = null): object |
36 | 36 | { |
37 | - if ($this->isNamedArgumentsSupported()) { |
|
38 | - try { |
|
37 | + if ($this->isNamedArgumentsSupported()){ |
|
38 | + try{ |
|
39 | 39 | return $attr->newInstanceArgs($arguments); |
40 | - } catch (\Throwable $e) { |
|
40 | + }catch (\Throwable $e){ |
|
41 | 41 | throw Exception::withLocation($e, $attr->getFileName(), $attr->getStartLine()); |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | 45 | $constructor = $this->getConstructor($attr); |
46 | 46 | |
47 | - if ($constructor === null) { |
|
47 | + if ($constructor === null){ |
|
48 | 48 | return $attr->newInstanceWithoutConstructor(); |
49 | 49 | } |
50 | 50 | |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | { |
73 | 73 | $passed = []; |
74 | 74 | |
75 | - try { |
|
76 | - foreach ($constructor->getParameters() as $parameter) { |
|
75 | + try{ |
|
76 | + foreach ($constructor->getParameters() as $parameter){ |
|
77 | 77 | $passed[] = $this->resolveParameter($ctx, $parameter, $arguments); |
78 | 78 | } |
79 | 79 | |
80 | - if (\count($arguments)) { |
|
80 | + if (\count($arguments)){ |
|
81 | 81 | $message = \sprintf(self::ERROR_UNKNOWN_ARGUMENT, \array_key_first($arguments)); |
82 | 82 | throw new \BadMethodCallException($message); |
83 | 83 | } |
84 | - } catch (\Throwable $e) { |
|
84 | + }catch (\Throwable $e){ |
|
85 | 85 | throw Exception::withLocation($e, $constructor->getFileName(), $constructor->getStartLine()); |
86 | 86 | } |
87 | 87 | |
@@ -97,19 +97,19 @@ discard block |
||
97 | 97 | */ |
98 | 98 | private function resolveParameter(\ReflectionClass $ctx, \ReflectionParameter $param, array &$arguments) |
99 | 99 | { |
100 | - switch (true) { |
|
100 | + switch (true){ |
|
101 | 101 | case \array_key_exists($param->getName(), $arguments): |
102 | - try { |
|
102 | + try{ |
|
103 | 103 | return $arguments[$param->getName()]; |
104 | - } finally { |
|
104 | + }finally{ |
|
105 | 105 | unset($arguments[$param->getName()]); |
106 | 106 | } |
107 | 107 | // no actual falling through |
108 | 108 | |
109 | 109 | case \array_key_exists($param->getPosition(), $arguments): |
110 | - try { |
|
110 | + try{ |
|
111 | 111 | return $arguments[$param->getPosition()]; |
112 | - } finally { |
|
112 | + }finally{ |
|
113 | 113 | unset($arguments[$param->getPosition()]); |
114 | 114 | } |
115 | 115 | // no actual falling through |
@@ -34,17 +34,22 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function instantiate(\ReflectionClass $attr, array $arguments, \Reflector $context = null): object |
36 | 36 | { |
37 | - if ($this->isNamedArgumentsSupported()) { |
|
38 | - try { |
|
37 | + if ($this->isNamedArgumentsSupported()) |
|
38 | + { |
|
39 | + try |
|
40 | + { |
|
39 | 41 | return $attr->newInstanceArgs($arguments); |
40 | - } catch (\Throwable $e) { |
|
42 | + } |
|
43 | + catch (\Throwable $e) |
|
44 | + { |
|
41 | 45 | throw Exception::withLocation($e, $attr->getFileName(), $attr->getStartLine()); |
42 | 46 | } |
43 | 47 | } |
44 | 48 | |
45 | 49 | $constructor = $this->getConstructor($attr); |
46 | 50 | |
47 | - if ($constructor === null) { |
|
51 | + if ($constructor === null) |
|
52 | + { |
|
48 | 53 | return $attr->newInstanceWithoutConstructor(); |
49 | 54 | } |
50 | 55 | |
@@ -72,16 +77,21 @@ discard block |
||
72 | 77 | { |
73 | 78 | $passed = []; |
74 | 79 | |
75 | - try { |
|
76 | - foreach ($constructor->getParameters() as $parameter) { |
|
80 | + try |
|
81 | + { |
|
82 | + foreach ($constructor->getParameters() as $parameter) |
|
83 | + { |
|
77 | 84 | $passed[] = $this->resolveParameter($ctx, $parameter, $arguments); |
78 | 85 | } |
79 | 86 | |
80 | - if (\count($arguments)) { |
|
87 | + if (\count($arguments)) |
|
88 | + { |
|
81 | 89 | $message = \sprintf(self::ERROR_UNKNOWN_ARGUMENT, \array_key_first($arguments)); |
82 | 90 | throw new \BadMethodCallException($message); |
83 | 91 | } |
84 | - } catch (\Throwable $e) { |
|
92 | + } |
|
93 | + catch (\Throwable $e) |
|
94 | + { |
|
85 | 95 | throw Exception::withLocation($e, $constructor->getFileName(), $constructor->getStartLine()); |
86 | 96 | } |
87 | 97 | |
@@ -97,19 +107,26 @@ discard block |
||
97 | 107 | */ |
98 | 108 | private function resolveParameter(\ReflectionClass $ctx, \ReflectionParameter $param, array &$arguments) |
99 | 109 | { |
100 | - switch (true) { |
|
110 | + switch (true) |
|
111 | + { |
|
101 | 112 | case \array_key_exists($param->getName(), $arguments): |
102 | - try { |
|
113 | + try |
|
114 | + { |
|
103 | 115 | return $arguments[$param->getName()]; |
104 | - } finally { |
|
116 | + } |
|
117 | + finally |
|
118 | + { |
|
105 | 119 | unset($arguments[$param->getName()]); |
106 | 120 | } |
107 | 121 | // no actual falling through |
108 | 122 | |
109 | 123 | case \array_key_exists($param->getPosition(), $arguments): |
110 | - try { |
|
124 | + try |
|
125 | + { |
|
111 | 126 | return $arguments[$param->getPosition()]; |
112 | - } finally { |
|
127 | + } |
|
128 | + finally |
|
129 | + { |
|
113 | 130 | unset($arguments[$param->getPosition()]); |
114 | 131 | } |
115 | 132 | // no actual falling through |
@@ -124,7 +124,7 @@ |
||
124 | 124 | */ |
125 | 125 | protected function iterableToArray(iterable $attributes): array |
126 | 126 | { |
127 | - if ($attributes instanceof \Traversable) { |
|
127 | + if ($attributes instanceof \Traversable){ |
|
128 | 128 | return \iterator_to_array($attributes, false); |
129 | 129 | } |
130 | 130 |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function getClassMetadata(\ReflectionClass $class, string $name = null): iterable |
43 | 43 | { |
44 | - $result = $this->cached($this->key->forClass($class), function () use ($class) { |
|
44 | + $result = $this->cached($this->key->forClass($class), function () use ($class) |
|
45 | + { |
|
45 | 46 | return $this->iterableToArray(parent::getClassMetadata($class)); |
46 | 47 | }); |
47 | 48 | |
@@ -53,7 +54,8 @@ discard block |
||
53 | 54 | */ |
54 | 55 | public function getFunctionMetadata(\ReflectionFunctionAbstract $function, string $name = null): iterable |
55 | 56 | { |
56 | - $result = $this->cached($this->key->forFunction($function), function () use ($function) { |
|
57 | + $result = $this->cached($this->key->forFunction($function), function () use ($function) |
|
58 | + { |
|
57 | 59 | return $this->iterableToArray(parent::getFunctionMetadata($function)); |
58 | 60 | }); |
59 | 61 | |
@@ -65,7 +67,8 @@ discard block |
||
65 | 67 | */ |
66 | 68 | public function getPropertyMetadata(\ReflectionProperty $property, string $name = null): iterable |
67 | 69 | { |
68 | - $result = $this->cached($this->key->forProperty($property), function () use ($property) { |
|
70 | + $result = $this->cached($this->key->forProperty($property), function () use ($property) |
|
71 | + { |
|
69 | 72 | return $this->iterableToArray(parent::getPropertyMetadata($property)); |
70 | 73 | }); |
71 | 74 | |
@@ -77,7 +80,8 @@ discard block |
||
77 | 80 | */ |
78 | 81 | public function getConstantMetadata(\ReflectionClassConstant $constant, string $name = null): iterable |
79 | 82 | { |
80 | - $result = $this->cached($this->key->forConstant($constant), function () use ($constant) { |
|
83 | + $result = $this->cached($this->key->forConstant($constant), function () use ($constant) |
|
84 | + { |
|
81 | 85 | return $this->iterableToArray(parent::getConstantMetadata($constant)); |
82 | 86 | }); |
83 | 87 | |
@@ -89,7 +93,8 @@ discard block |
||
89 | 93 | */ |
90 | 94 | public function getParameterMetadata(\ReflectionParameter $parameter, string $name = null): iterable |
91 | 95 | { |
92 | - $result = $this->cached($this->key->forParameter($parameter), function () use ($parameter) { |
|
96 | + $result = $this->cached($this->key->forParameter($parameter), function () use ($parameter) |
|
97 | + { |
|
93 | 98 | return $this->iterableToArray(parent::getParameterMetadata($parameter)); |
94 | 99 | }); |
95 | 100 | |
@@ -124,7 +129,8 @@ discard block |
||
124 | 129 | */ |
125 | 130 | protected function iterableToArray(iterable $attributes): array |
126 | 131 | { |
127 | - if ($attributes instanceof \Traversable) { |
|
132 | + if ($attributes instanceof \Traversable) |
|
133 | + { |
|
128 | 134 | return \iterator_to_array($attributes, false); |
129 | 135 | } |
130 | 136 |
@@ -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 |
@@ -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 | } |