@@ -106,14 +106,14 @@ |
||
106 | 106 | |
107 | 107 | return sprintf( |
108 | 108 | $reflectionFormat, |
109 | - $this->getDocComment() ? $this->getDocComment() . "\n" : '', |
|
109 | + $this->getDocComment() ? $this->getDocComment()."\n" : '', |
|
110 | 110 | $this->getName(), |
111 | 111 | $this->getFileName(), |
112 | 112 | $this->getStartLine(), |
113 | 113 | $this->getEndLine(), |
114 | 114 | count($this->getParameters()), |
115 | - array_reduce($this->getParameters(), function ($str, ReflectionParameter $param) { |
|
116 | - return $str . "\n " . $param; |
|
115 | + array_reduce($this->getParameters(), function($str, ReflectionParameter $param) { |
|
116 | + return $str."\n ".$param; |
|
117 | 117 | }, '') |
118 | 118 | ); |
119 | 119 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * Initializes reflection instance for given AST-node |
27 | 27 | * |
28 | 28 | * @param string|\Closure $functionName The name of the function to reflect or a closure. |
29 | - * @param Function_|null $functionNode Function node AST |
|
29 | + * @param Function_ $functionNode Function node AST |
|
30 | 30 | */ |
31 | 31 | public function __construct($functionName, Function_ $functionNode) |
32 | 32 | { |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | $isRelative = !$pathScheme && ($path[0] !== '/') && ($path[1] !== ':'); |
52 | 52 | if ($isRelative) { |
53 | - $path = getcwd() . DIRECTORY_SEPARATOR . $path; |
|
53 | + $path = getcwd().DIRECTORY_SEPARATOR.$path; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // resolve path parts (single dot, double dot and double delimiters) |
@@ -133,17 +133,17 @@ discard block |
||
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - $buildString = function (array $items, $indentLevel = 4) { |
|
136 | + $buildString = function(array $items, $indentLevel = 4) { |
|
137 | 137 | if (!count($items)) { |
138 | 138 | return ''; |
139 | 139 | } |
140 | - $indent = "\n" . str_repeat(' ', $indentLevel); |
|
141 | - return $indent . implode($indent, explode("\n", implode("\n", $items))); |
|
140 | + $indent = "\n".str_repeat(' ', $indentLevel); |
|
141 | + return $indent.implode($indent, explode("\n", implode("\n", $items))); |
|
142 | 142 | }; |
143 | - $buildConstants = function (array $items, $indentLevel = 4) { |
|
143 | + $buildConstants = function(array $items, $indentLevel = 4) { |
|
144 | 144 | $str = ''; |
145 | 145 | foreach ($items as $name => $value) { |
146 | - $str .= "\n" . str_repeat(' ', $indentLevel); |
|
146 | + $str .= "\n".str_repeat(' ', $indentLevel); |
|
147 | 147 | $str .= sprintf( |
148 | 148 | 'Constant [ %s %s ] { %s }', |
149 | 149 | gettype($value), |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | ($isObject ? 'Object of class' : 'Class'), |
168 | 168 | $modifiers, |
169 | 169 | $this->getName(), |
170 | - false !== $parentClass ? (' extends ' . $parentClass->getName()) : '', |
|
171 | - $interfaceNames ? (' implements ' . implode(', ', $interfaceNames)) : '', |
|
170 | + false !== $parentClass ? (' extends '.$parentClass->getName()) : '', |
|
171 | + $interfaceNames ? (' implements '.implode(', ', $interfaceNames)) : '', |
|
172 | 172 | $this->getFileName(), |
173 | 173 | $this->getStartLine(), |
174 | 174 | $this->getEndLine(), |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | public function getConstants() |
209 | 209 | { |
210 | 210 | if (!isset($this->constants)) { |
211 | - $this->constants = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance) { |
|
211 | + $this->constants = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance) { |
|
212 | 212 | $result += $instance->getConstants(); |
213 | 213 | }); |
214 | 214 | $this->collectSelfConstants(); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $staticOrder = [true, false]; |
246 | 246 | foreach ($staticOrder as $shouldBeStatic) { |
247 | 247 | foreach ($properties as $property) { |
248 | - $isStaticProperty = $property->isStatic(); |
|
248 | + $isStaticProperty = $property->isStatic(); |
|
249 | 249 | if ($shouldBeStatic !== $isStaticProperty) { |
250 | 250 | continue; |
251 | 251 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | public function getInterfaces() |
310 | 310 | { |
311 | 311 | if (!isset($this->interfaceClasses)) { |
312 | - $this->interfaceClasses = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance) { |
|
312 | + $this->interfaceClasses = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance) { |
|
313 | 313 | if ($instance->isInterface()) { |
314 | 314 | $result[$instance->name] = $instance; |
315 | 315 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | { |
347 | 347 | if (!isset($this->methods)) { |
348 | 348 | $directMethods = ReflectionMethod::collectFromClassNode($this->classLikeNode, $this); |
349 | - $parentMethods = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) { |
|
349 | + $parentMethods = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) { |
|
350 | 350 | $reflectionMethods = []; |
351 | 351 | foreach ($instance->getMethods() as $reflectionMethod) { |
352 | 352 | if (!$isParent || !$reflectionMethod->isPrivate()) { |
@@ -416,9 +416,9 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public function getName() |
418 | 418 | { |
419 | - $namespaceName = $this->namespaceName ? $this->namespaceName . '\\' : ''; |
|
419 | + $namespaceName = $this->namespaceName ? $this->namespaceName.'\\' : ''; |
|
420 | 420 | |
421 | - return $namespaceName . $this->getShortName(); |
|
421 | + return $namespaceName.$this->getShortName(); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | { |
463 | 463 | if (!isset($this->properties)) { |
464 | 464 | $directProperties = ReflectionProperty::collectFromClassNode($this->classLikeNode, $this->getName()); |
465 | - $parentProperties = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) { |
|
465 | + $parentProperties = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) { |
|
466 | 466 | $reflectionProperties = []; |
467 | 467 | foreach ($instance->getProperties() as $reflectionProperty) { |
468 | 468 | if (!$isParent || !$reflectionProperty->isPrivate()) { |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | break; |
543 | 543 | } |
544 | 544 | } |
545 | - $aliases[$adaptation->newName] = $traitName . '::'. $methodName; |
|
545 | + $aliases[$adaptation->newName] = $traitName.'::'.$methodName; |
|
546 | 546 | } |
547 | 547 | } |
548 | 548 |
@@ -174,7 +174,7 @@ |
||
174 | 174 | /** |
175 | 175 | * Gets the specified return type of a function |
176 | 176 | * |
177 | - * @return \ReflectionType |
|
177 | + * @return null|ReflectionType |
|
178 | 178 | * |
179 | 179 | * @link http://php.net/manual/en/reflectionfunctionabstract.getreturntype.php |
180 | 180 | */ |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | if ($this->functionLikeNode instanceof Function_ || $this->functionLikeNode instanceof ClassMethod) { |
103 | 103 | $functionName = $this->functionLikeNode->name->toString(); |
104 | 104 | |
105 | - return $this->namespaceName ? $this->namespaceName . '\\' . $functionName : $functionName; |
|
105 | + return $this->namespaceName ? $this->namespaceName.'\\'.$functionName : $functionName; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | return false; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | foreach ($this->functionLikeNode->getParams() as $parameterIndex => $parameterNode) { |
159 | 159 | $reflectionParameter = new ReflectionParameter( |
160 | 160 | $this->getName(), |
161 | - (string)$parameterNode->var->name, |
|
161 | + (string) $parameterNode->var->name, |
|
162 | 162 | $parameterNode, |
163 | 163 | $parameterIndex, |
164 | 164 | $this |
@@ -95,12 +95,12 @@ |
||
95 | 95 | $paramString = ''; |
96 | 96 | $identation = str_repeat(' ', 4); |
97 | 97 | foreach ($methodParameters as $methodParameter) { |
98 | - $paramString .= "\n{$identation}" . $methodParameter; |
|
98 | + $paramString .= "\n{$identation}".$methodParameter; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | return sprintf( |
102 | 102 | "%sMethod [ <user%s%s%s>%s%s%s %s method %s ] {\n @@ %s %d - %d{$paramFormat}{$returnFormat}\n}\n", |
103 | - $this->getDocComment() ? $this->getDocComment() . "\n" : '', |
|
103 | + $this->getDocComment() ? $this->getDocComment()."\n" : '', |
|
104 | 104 | $prototype ? ", overwrites {$prototypeClass}, prototype {$prototypeClass}" : '', |
105 | 105 | $this->isConstructor() ? ', ctor' : '', |
106 | 106 | $this->isDestructor() ? ', dtor' : '', |
@@ -10,7 +10,6 @@ |
||
10 | 10 | |
11 | 11 | namespace Go\ParserReflection\NodeVisitor; |
12 | 12 | |
13 | -use PhpParser\Node\Name\FullyQualified; |
|
14 | 13 | use PhpParser\Node\Stmt\Declare_; |
15 | 14 | use PhpParser\Node\Stmt\Namespace_; |
16 | 15 | use PhpParser\NodeVisitorAbstract; |
@@ -85,7 +85,7 @@ |
||
85 | 85 | 'int' => 'integer', |
86 | 86 | 'bool' => 'boolean' |
87 | 87 | ]; |
88 | - $displayType = (string)$type; |
|
88 | + $displayType = (string) $type; |
|
89 | 89 | if (isset($typeMap[$displayType])) { |
90 | 90 | $displayType = $typeMap[$displayType]; |
91 | 91 | } |
@@ -17,4 +17,4 @@ |
||
17 | 17 | */ |
18 | 18 | ReflectionEngine::init(new ComposerLocator()); |
19 | 19 | |
20 | -require(__DIR__ . '/polyfill.php'); |
|
20 | +require(__DIR__.'/polyfill.php'); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | protected function resolveScalarMagicConstMethod() |
142 | 142 | { |
143 | 143 | if ($this->context instanceof \ReflectionMethod) { |
144 | - $fullName = $this->context->getDeclaringClass()->name . '::' . $this->context->getShortName(); |
|
144 | + $fullName = $this->context->getDeclaringClass()->name.'::'.$this->context->getShortName(); |
|
145 | 145 | |
146 | 146 | return $fullName; |
147 | 147 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $fileNamespace = new ReflectionFileNamespace($fileName, $namespaceName); |
234 | 234 | if ($fileNamespace->hasConstant($constantName)) { |
235 | 235 | $constantValue = $fileNamespace->getConstant($constantName); |
236 | - $constantName = $fileNamespace->getName() . '\\' . $constantName; |
|
236 | + $constantName = $fileNamespace->getName().'\\'.$constantName; |
|
237 | 237 | $isResolved = true; |
238 | 238 | } |
239 | 239 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $reason = 'Unable'; |
261 | 261 | if ($classToReflect instanceof Expr) { |
262 | 262 | $methodName = $this->getDispatchMethodFor($classToReflect); |
263 | - $reason = "Method " . __CLASS__ . "::{$methodName}() not found trying"; |
|
263 | + $reason = "Method ".__CLASS__."::{$methodName}() not found trying"; |
|
264 | 264 | } |
265 | 265 | throw new ReflectionException("$reason to resolve class constant."); |
266 | 266 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | $this->isConstant = true; |
280 | - $this->constantName = (string)$classToReflect . '::' . $constantName; |
|
280 | + $this->constantName = (string) $classToReflect.'::'.$constantName; |
|
281 | 281 | |
282 | 282 | return $refClass->getConstant($constantName); |
283 | 283 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | protected function resolveExprBinaryOpConcat(Expr\BinaryOp\Concat $node) |
363 | 363 | { |
364 | - return $this->resolve($node->left) . $this->resolve($node->right); |
|
364 | + return $this->resolve($node->left).$this->resolve($node->right); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | protected function resolveExprTernary(Expr\Ternary $node) |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | private function getDispatchMethodFor(Node $node) |
446 | 446 | { |
447 | 447 | $nodeType = $node->getType(); |
448 | - return 'resolve' . str_replace('_', '', $nodeType); |
|
448 | + return 'resolve'.str_replace('_', '', $nodeType); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | /** |