@@ -24,8 +24,8 @@ |
||
| 24 | 24 | /** |
| 25 | 25 | * Initializes reflection instance for given AST-node |
| 26 | 26 | * |
| 27 | - * @param string|\Closure $functionName The name of the function to reflect or a closure. |
|
| 28 | - * @param Function_|null $functionNode Function node AST |
|
| 27 | + * @param string $functionName The name of the function to reflect or a closure. |
|
| 28 | + * @param Function_ $functionNode Function node AST |
|
| 29 | 29 | */ |
| 30 | 30 | public function __construct($functionName, Function_ $functionNode) |
| 31 | 31 | { |
@@ -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 | } |
@@ -306,6 +306,7 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | /** |
| 308 | 308 | * {@inheritdoc} |
| 309 | + * @param string $name |
|
| 309 | 310 | */ |
| 310 | 311 | public function getMethod($name) |
| 311 | 312 | { |
@@ -499,6 +500,7 @@ discard block |
||
| 499 | 500 | |
| 500 | 501 | /** |
| 501 | 502 | * {@inheritdoc} |
| 503 | + * @param string $name |
|
| 502 | 504 | */ |
| 503 | 505 | public function hasMethod($name) |
| 504 | 506 | { |
@@ -529,6 +531,7 @@ discard block |
||
| 529 | 531 | |
| 530 | 532 | /** |
| 531 | 533 | * {@inheritDoc} |
| 534 | + * @param string $interfaceName |
|
| 532 | 535 | */ |
| 533 | 536 | public function implementsInterface($interfaceName) |
| 534 | 537 | { |
@@ -139,17 +139,17 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $buildString = function (array $items, $indentLevel = 4) { |
|
| 142 | + $buildString = function(array $items, $indentLevel = 4) { |
|
| 143 | 143 | if (!count($items)) { |
| 144 | 144 | return ''; |
| 145 | 145 | } |
| 146 | - $indent = "\n" . str_repeat(' ', $indentLevel); |
|
| 147 | - return $indent . implode($indent, explode("\n", implode("\n", $items))); |
|
| 146 | + $indent = "\n".str_repeat(' ', $indentLevel); |
|
| 147 | + return $indent.implode($indent, explode("\n", implode("\n", $items))); |
|
| 148 | 148 | }; |
| 149 | - $buildConstants = function (array $items, $indentLevel = 4) { |
|
| 149 | + $buildConstants = function(array $items, $indentLevel = 4) { |
|
| 150 | 150 | $str = ''; |
| 151 | 151 | foreach ($items as $name => $value) { |
| 152 | - $str .= "\n" . str_repeat(' ', $indentLevel); |
|
| 152 | + $str .= "\n".str_repeat(' ', $indentLevel); |
|
| 153 | 153 | $str .= sprintf( |
| 154 | 154 | 'Constant [ %s %s ] { %s }', |
| 155 | 155 | gettype($value), |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | ($isObject ? 'Object of class' : 'Class'), |
| 174 | 174 | $modifiers, |
| 175 | 175 | $this->getName(), |
| 176 | - false !== $parentClass ? (' extends ' . $parentClass->getName()) : '', |
|
| 177 | - $interfaceNames ? (' implements ' . implode(', ', $interfaceNames)) : '', |
|
| 176 | + false !== $parentClass ? (' extends '.$parentClass->getName()) : '', |
|
| 177 | + $interfaceNames ? (' implements '.implode(', ', $interfaceNames)) : '', |
|
| 178 | 178 | $this->getFileName(), |
| 179 | 179 | $this->getStartLine(), |
| 180 | 180 | $this->getEndLine(), |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | public function getConstants() |
| 215 | 215 | { |
| 216 | 216 | if (!isset($this->constants)) { |
| 217 | - $this->constants = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance) { |
|
| 217 | + $this->constants = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance) { |
|
| 218 | 218 | $result += $instance->getConstants(); |
| 219 | 219 | }); |
| 220 | 220 | $this->collectSelfConstants(); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $staticOrder = [true, false]; |
| 252 | 252 | foreach ($staticOrder as $shouldBeStatic) { |
| 253 | 253 | foreach ($properties as $property) { |
| 254 | - $isStaticProperty = $property->isStatic(); |
|
| 254 | + $isStaticProperty = $property->isStatic(); |
|
| 255 | 255 | if ($shouldBeStatic !== $isStaticProperty) { |
| 256 | 256 | continue; |
| 257 | 257 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | public function getInterfaces() |
| 316 | 316 | { |
| 317 | 317 | if (!isset($this->interfaceClasses)) { |
| 318 | - $this->interfaceClasses = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance) { |
|
| 318 | + $this->interfaceClasses = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance) { |
|
| 319 | 319 | if ($instance->isInterface()) { |
| 320 | 320 | $result[$instance->name] = $instance; |
| 321 | 321 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | { |
| 353 | 353 | if (!isset($this->methods)) { |
| 354 | 354 | $directMethods = ReflectionMethod::collectFromClassNode($this->classLikeNode, $this, $this->reflectionParser); |
| 355 | - $parentMethods = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) { |
|
| 355 | + $parentMethods = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) { |
|
| 356 | 356 | $reflectionMethods = []; |
| 357 | 357 | foreach ($instance->getMethods() as $reflectionMethod) { |
| 358 | 358 | if (!$isParent || !$reflectionMethod->isPrivate()) { |
@@ -422,9 +422,9 @@ discard block |
||
| 422 | 422 | */ |
| 423 | 423 | public function getName() |
| 424 | 424 | { |
| 425 | - $namespaceName = $this->namespaceName ? $this->namespaceName . '\\' : ''; |
|
| 425 | + $namespaceName = $this->namespaceName ? $this->namespaceName.'\\' : ''; |
|
| 426 | 426 | |
| 427 | - return $namespaceName . $this->getShortName(); |
|
| 427 | + return $namespaceName.$this->getShortName(); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | /** |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | { |
| 469 | 469 | if (!isset($this->properties)) { |
| 470 | 470 | $directProperties = ReflectionProperty::collectFromClassNode($this->classLikeNode, $this->getName(), $this->reflectionParser); |
| 471 | - $parentProperties = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) { |
|
| 471 | + $parentProperties = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) { |
|
| 472 | 472 | $reflectionProperties = []; |
| 473 | 473 | foreach ($instance->getProperties() as $reflectionProperty) { |
| 474 | 474 | if (!$isParent || !$reflectionProperty->isPrivate()) { |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | break; |
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | - $aliases[$adaptation->newName] = $traitName . '::'. $methodName; |
|
| 551 | + $aliases[$adaptation->newName] = $traitName.'::'.$methodName; |
|
| 552 | 552 | } |
| 553 | 553 | } |
| 554 | 554 | |
@@ -101,7 +101,7 @@ |
||
| 101 | 101 | if ($this->functionLikeNode instanceof Function_ || $this->functionLikeNode instanceof ClassMethod) { |
| 102 | 102 | $functionName = $this->functionLikeNode->name; |
| 103 | 103 | |
| 104 | - return $this->namespaceName ? $this->namespaceName . '\\' . $functionName : $functionName; |
|
| 104 | + return $this->namespaceName ? $this->namespaceName.'\\'.$functionName : $functionName; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | return false; |
@@ -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 | */ |
@@ -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) |
@@ -159,6 +159,9 @@ |
||
| 159 | 159 | return ''; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | + /** |
|
| 163 | + * @return string |
|
| 164 | + */ |
|
| 162 | 165 | protected function resolveScalarMagicConstNamespace() |
| 163 | 166 | { |
| 164 | 167 | if (method_exists($this->context, 'getNamespaceName')) { |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | ++$this->nodeLevel; |
| 121 | 121 | |
| 122 | 122 | $nodeType = $node->getType(); |
| 123 | - $methodName = 'resolve' . str_replace('_', '', $nodeType); |
|
| 123 | + $methodName = 'resolve'.str_replace('_', '', $nodeType); |
|
| 124 | 124 | if (method_exists($this, $methodName)) { |
| 125 | 125 | $value = $this->$methodName($node); |
| 126 | 126 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | protected function resolveScalarMagicConstMethod() |
| 150 | 150 | { |
| 151 | 151 | if ($this->context instanceof \ReflectionMethod) { |
| 152 | - $fullName = $this->context->getDeclaringClass()->getName() . '::' . $this->context->getShortName(); |
|
| 152 | + $fullName = $this->context->getDeclaringClass()->getName().'::'.$this->context->getShortName(); |
|
| 153 | 153 | |
| 154 | 154 | return $fullName; |
| 155 | 155 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $fileNamespace = new ReflectionFileNamespace($fileName, $namespaceName, null, $this->reflectionParser); |
| 244 | 244 | if ($fileNamespace->hasConstant($constantName)) { |
| 245 | 245 | $constantValue = $fileNamespace->getConstant($constantName); |
| 246 | - $constantName = $fileNamespace->getName() . '\\' . $constantName; |
|
| 246 | + $constantName = $fileNamespace->getName().'\\'.$constantName; |
|
| 247 | 247 | $isResolved = true; |
| 248 | 248 | } |
| 249 | 249 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $this->isConstant = true; |
| 275 | - $this->constantName = (string)$node->class . '::' . $constantName; |
|
| 275 | + $this->constantName = (string) $node->class.'::'.$constantName; |
|
| 276 | 276 | |
| 277 | 277 | return $refClass->getConstant($constantName); |
| 278 | 278 | } |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | protected function resolveExprBinaryOpConcat(Expr\BinaryOp\Concat $node) |
| 358 | 358 | { |
| 359 | - return $this->resolve($node->left) . $this->resolve($node->right); |
|
| 359 | + return $this->resolve($node->left).$this->resolve($node->right); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | protected function resolveExprTernary(Expr\Ternary $node) |
@@ -38,6 +38,8 @@ |
||
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Initializes reflection data |
| 41 | + * @param boolean $allowsNull |
|
| 42 | + * @param boolean $isBuiltin |
|
| 41 | 43 | */ |
| 42 | 44 | public function __construct($type, $allowsNull, $isBuiltin) |
| 43 | 45 | { |
@@ -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' : '', |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | /** |
| 29 | 29 | * Initializes reflection instance |
| 30 | 30 | * |
| 31 | - * @param string|object $argument Class name or instance of object |
|
| 31 | + * @param string|null $argument Class name or instance of object |
|
| 32 | 32 | * @param ClassLike $classLikeNode AST node for class |
| 33 | 33 | * @param ReflectionParser $reflectionParser AST parser |
| 34 | 34 | */ |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
| 327 | 327 | if ($namespaceLevelNode instanceof ClassLike) { |
| 328 | 328 | $classShortName = $namespaceLevelNode->name; |
| 329 | - $className = $namespaceName ? $namespaceName .'\\' . $classShortName : $classShortName; |
|
| 329 | + $className = $namespaceName ? $namespaceName.'\\'.$classShortName : $classShortName; |
|
| 330 | 330 | |
| 331 | 331 | $namespaceLevelNode->setAttribute('fileName', $this->fileName); |
| 332 | 332 | $classes[$className] = new ReflectionClass($className, $namespaceLevelNode, $this->reflectionParser); |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
| 351 | 351 | if ($namespaceLevelNode instanceof Function_) { |
| 352 | 352 | $funcShortName = $namespaceLevelNode->name; |
| 353 | - $functionName = $namespaceName ? $namespaceName .'\\' . $funcShortName : $funcShortName; |
|
| 353 | + $functionName = $namespaceName ? $namespaceName.'\\'.$funcShortName : $funcShortName; |
|
| 354 | 354 | |
| 355 | 355 | $namespaceLevelNode->setAttribute('fileName', $this->fileName); |
| 356 | 356 | $functions[$funcShortName] = new ReflectionFunction($functionName, $namespaceLevelNode); |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
| 390 | 390 | if ($namespaceLevelNode instanceof FuncCall |
| 391 | 391 | && $namespaceLevelNode->name instanceof Name |
| 392 | - && (string)$namespaceLevelNode->name === 'define' |
|
| 392 | + && (string) $namespaceLevelNode->name === 'define' |
|
| 393 | 393 | ) { |
| 394 | 394 | $expressionSolver->process($namespaceLevelNode->args[0]->value); |
| 395 | 395 | $constantName = $expressionSolver->getValue(); |