@@ -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) |
@@ -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' : '', |
@@ -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 | /** |
@@ -160,6 +160,7 @@ |
||
| 160 | 160 | |
| 161 | 161 | /** |
| 162 | 162 | * @inheritDoc |
| 163 | + * @return string |
|
| 163 | 164 | */ |
| 164 | 165 | public function getName() |
| 165 | 166 | { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | public function ___debugInfo() |
| 122 | 122 | { |
| 123 | 123 | return array( |
| 124 | - 'name' => (string)$this->parameterNode->var->name, |
|
| 124 | + 'name' => (string) $this->parameterNode->var->name, |
|
| 125 | 125 | ); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | if ($hasDefaultValue) { |
| 140 | 140 | $defaultValue = $this->getDefaultValue(); |
| 141 | 141 | if (is_string($defaultValue) && strlen($defaultValue) > 15) { |
| 142 | - $defaultValue = substr($defaultValue, 0, 15) . '...'; |
|
| 142 | + $defaultValue = substr($defaultValue, 0, 15).'...'; |
|
| 143 | 143 | } |
| 144 | 144 | /* @see https://3v4l.org/DJOEb for behaviour changes */ |
| 145 | 145 | if (is_double($defaultValue) && fmod($defaultValue, 1.0) === 0.0) { |
| 146 | - $defaultValue = (int)$defaultValue; |
|
| 146 | + $defaultValue = (int) $defaultValue; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $defaultValue = str_replace('\\\\', '\\', var_export($defaultValue, true)); |
@@ -153,11 +153,11 @@ discard block |
||
| 153 | 153 | 'Parameter #%d [ %s %s%s%s$%s%s ]', |
| 154 | 154 | $this->parameterIndex, |
| 155 | 155 | $isOptional ? '<optional>' : '<required>', |
| 156 | - $parameterType ? ReflectionType::convertToDisplayType($parameterType) . ' ' : '', |
|
| 156 | + $parameterType ? ReflectionType::convertToDisplayType($parameterType).' ' : '', |
|
| 157 | 157 | $this->isVariadic() ? '...' : '', |
| 158 | 158 | $this->isPassedByReference() ? '&' : '', |
| 159 | 159 | $this->getName(), |
| 160 | - ($isOptional && $hasDefaultValue) ? (' = ' . $defaultValue) : '' |
|
| 160 | + ($isOptional && $hasDefaultValue) ? (' = '.$defaultValue) : '' |
|
| 161 | 161 | ); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | throw new ReflectionException("Can not resolve a class name for parameter"); |
| 209 | 209 | } |
| 210 | - $className = $parameterType->toString(); |
|
| 210 | + $className = $parameterType->toString(); |
|
| 211 | 211 | $classOrInterfaceExists = class_exists($className, false) || interface_exists($className, false); |
| 212 | 212 | |
| 213 | 213 | return $classOrInterfaceExists ? new \ReflectionClass($className) : new ReflectionClass($className); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | public function getName() |
| 267 | 267 | { |
| 268 | - return (string)$this->parameterNode->var->name; |
|
| 268 | + return (string) $this->parameterNode->var->name; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $comments = $this->namespaceNode->getAttribute('comments'); |
| 183 | 183 | |
| 184 | 184 | if ($comments) { |
| 185 | - $docComment = (string)$comments[0]; |
|
| 185 | + $docComment = (string) $comments[0]; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | return $docComment; |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
| 356 | 356 | if ($namespaceLevelNode instanceof ClassLike) { |
| 357 | 357 | $classShortName = $namespaceLevelNode->name->toString(); |
| 358 | - $className = $namespaceName ? $namespaceName .'\\' . $classShortName : $classShortName; |
|
| 358 | + $className = $namespaceName ? $namespaceName.'\\'.$classShortName : $classShortName; |
|
| 359 | 359 | |
| 360 | 360 | $namespaceLevelNode->setAttribute('fileName', $this->fileName); |
| 361 | 361 | $classes[$className] = new ReflectionClass($className, $namespaceLevelNode); |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
| 380 | 380 | if ($namespaceLevelNode instanceof Function_) { |
| 381 | 381 | $funcShortName = $namespaceLevelNode->name->toString(); |
| 382 | - $functionName = $namespaceName ? $namespaceName .'\\' . $funcShortName : $funcShortName; |
|
| 382 | + $functionName = $namespaceName ? $namespaceName.'\\'.$funcShortName : $funcShortName; |
|
| 383 | 383 | |
| 384 | 384 | $namespaceLevelNode->setAttribute('fileName', $this->fileName); |
| 385 | 385 | $functions[$funcShortName] = new ReflectionFunction($functionName, $namespaceLevelNode); |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | if ($namespaceLevelNode instanceof Expression |
| 420 | 420 | && $namespaceLevelNode->expr instanceof FuncCall |
| 421 | 421 | && $namespaceLevelNode->expr->name instanceof Name |
| 422 | - && (string)$namespaceLevelNode->expr->name === 'define' |
|
| 422 | + && (string) $namespaceLevelNode->expr->name === 'define' |
|
| 423 | 423 | ) { |
| 424 | 424 | $functionCallNode = $namespaceLevelNode->expr; |
| 425 | 425 | $expressionSolver->process($functionCallNode->args[0]->value); |
@@ -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 | } |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | { |
| 354 | 354 | if (!isset($this->methods)) { |
| 355 | 355 | $directMethods = ReflectionMethod::collectFromClassNode($this->classLikeNode, $this); |
| 356 | - $parentMethods = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) { |
|
| 356 | + $parentMethods = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) { |
|
| 357 | 357 | $reflectionMethods = []; |
| 358 | 358 | foreach ($instance->getMethods() as $reflectionMethod) { |
| 359 | 359 | if (!$isParent || !$reflectionMethod->isPrivate()) { |
@@ -423,9 +423,9 @@ discard block |
||
| 423 | 423 | */ |
| 424 | 424 | public function getName() |
| 425 | 425 | { |
| 426 | - $namespaceName = $this->namespaceName ? $this->namespaceName . '\\' : ''; |
|
| 426 | + $namespaceName = $this->namespaceName ? $this->namespaceName.'\\' : ''; |
|
| 427 | 427 | |
| 428 | - return $namespaceName . $this->getShortName(); |
|
| 428 | + return $namespaceName.$this->getShortName(); |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | /** |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | { |
| 470 | 470 | if (!isset($this->properties)) { |
| 471 | 471 | $directProperties = ReflectionProperty::collectFromClassNode($this->classLikeNode, $this->getName()); |
| 472 | - $parentProperties = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) { |
|
| 472 | + $parentProperties = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) { |
|
| 473 | 473 | $reflectionProperties = []; |
| 474 | 474 | foreach ($instance->getProperties() as $reflectionProperty) { |
| 475 | 475 | if (!$isParent || !$reflectionProperty->isPrivate()) { |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | { |
| 537 | 537 | if (!isset($this->classConstants)) { |
| 538 | 538 | $directClassConstants = ReflectionClassConstant::collectFromClassNode($this->classLikeNode, $this->getName()); |
| 539 | - $parentClassConstants = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) { |
|
| 539 | + $parentClassConstants = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) { |
|
| 540 | 540 | $reflectionClassConstants = []; |
| 541 | 541 | foreach ($instance->getReflectionConstants() as $reflectionClassConstant) { |
| 542 | 542 | if (!$isParent || !$reflectionClassConstant->isPrivate()) { |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | break; |
| 589 | 589 | } |
| 590 | 590 | } |
| 591 | - $aliases[$adaptation->newName] = $traitName . '::'. $methodName; |
|
| 591 | + $aliases[$adaptation->newName] = $traitName.'::'.$methodName; |
|
| 592 | 592 | } |
| 593 | 593 | } |
| 594 | 594 | |