| @@ -25,7 +25,7 @@ | ||
| 25 | 25 | /** | 
| 26 | 26 | * Initializes reflection instance | 
| 27 | 27 | * | 
| 28 | - * @param string|object $argument Class name or instance of object | |
| 28 | + * @param string $argument Class name or instance of object | |
| 29 | 29 | * @param ClassLike $classLikeNode AST node for class | 
| 30 | 30 | */ | 
| 31 | 31 | public function __construct($argument, ClassLike $classLikeNode = null) | 
| @@ -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 |      { | 
| @@ -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(), | 
| @@ -209,7 +209,7 @@ discard block | ||
| 209 | 209 |      { | 
| 210 | 210 |          if (!isset($this->constants)) { | 
| 211 | 211 | $directConstants = $this->findConstants(); | 
| 212 | -            $parentConstants = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance) { | |
| 212 | +            $parentConstants = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance) { | |
| 213 | 213 | $result += $instance->getConstants(); | 
| 214 | 214 | }); | 
| 215 | 215 | $constants = $directConstants + $parentConstants; | 
| @@ -248,7 +248,7 @@ discard block | ||
| 248 | 248 | $staticOrder = [true, false]; | 
| 249 | 249 |          foreach ($staticOrder as $shouldBeStatic) { | 
| 250 | 250 |              foreach ($properties as $property) { | 
| 251 | - $isStaticProperty = $property->isStatic(); | |
| 251 | + $isStaticProperty = $property->isStatic(); | |
| 252 | 252 |                  if ($shouldBeStatic !== $isStaticProperty) { | 
| 253 | 253 | continue; | 
| 254 | 254 | } | 
| @@ -312,7 +312,7 @@ discard block | ||
| 312 | 312 | public function getInterfaces() | 
| 313 | 313 |      { | 
| 314 | 314 |          if (!isset($this->interfaceClasses)) { | 
| 315 | -            $this->interfaceClasses = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance) { | |
| 315 | +            $this->interfaceClasses = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance) { | |
| 316 | 316 |                  if ($instance->isInterface()) { | 
| 317 | 317 | $result[$instance->name] = $instance; | 
| 318 | 318 | } | 
| @@ -349,7 +349,7 @@ discard block | ||
| 349 | 349 |      { | 
| 350 | 350 |          if (!isset($this->methods)) { | 
| 351 | 351 | $directMethods = ReflectionMethod::collectFromClassNode($this->classLikeNode, $this); | 
| 352 | -            $parentMethods = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) { | |
| 352 | +            $parentMethods = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) { | |
| 353 | 353 | $reflectionMethods = []; | 
| 354 | 354 |                  foreach ($instance->getMethods() as $reflectionMethod) { | 
| 355 | 355 |                      if (!$isParent || !$reflectionMethod->isPrivate()) { | 
| @@ -419,9 +419,9 @@ discard block | ||
| 419 | 419 | */ | 
| 420 | 420 | public function getName() | 
| 421 | 421 |      { | 
| 422 | - $namespaceName = $this->namespaceName ? $this->namespaceName . '\\' : ''; | |
| 422 | + $namespaceName = $this->namespaceName ? $this->namespaceName.'\\' : ''; | |
| 423 | 423 | |
| 424 | - return $namespaceName . $this->getShortName(); | |
| 424 | + return $namespaceName.$this->getShortName(); | |
| 425 | 425 | } | 
| 426 | 426 | |
| 427 | 427 | /** | 
| @@ -465,7 +465,7 @@ discard block | ||
| 465 | 465 |      { | 
| 466 | 466 |          if (!isset($this->properties)) { | 
| 467 | 467 | $directProperties = ReflectionProperty::collectFromClassNode($this->classLikeNode, $this->getName()); | 
| 468 | -            $parentProperties = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) { | |
| 468 | +            $parentProperties = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) { | |
| 469 | 469 | $reflectionProperties = []; | 
| 470 | 470 |                  foreach ($instance->getProperties() as $reflectionProperty) { | 
| 471 | 471 |                      if (!$isParent || !$reflectionProperty->isPrivate()) { | 
| @@ -545,7 +545,7 @@ discard block | ||
| 545 | 545 | break; | 
| 546 | 546 | } | 
| 547 | 547 | } | 
| 548 | - $aliases[$adaptation->newName] = $traitName . '::'. $methodName; | |
| 548 | + $aliases[$adaptation->newName] = $traitName.'::'.$methodName; | |
| 549 | 549 | } | 
| 550 | 550 | } | 
| 551 | 551 | |
| @@ -58,7 +58,7 @@ | ||
| 58 | 58 | Property $propertyType = null, | 
| 59 | 59 | PropertyProperty $propertyNode = null) | 
| 60 | 60 |      { | 
| 61 | - $this->className = $className; | |
| 61 | + $this->className = $className; | |
| 62 | 62 |          if (!$propertyType || !$propertyNode) { | 
| 63 | 63 | list ($propertyType, $propertyNode) = ReflectionEngine::parseClassProperty($className, $propertyName); | 
| 64 | 64 | } | 
| @@ -298,7 +298,7 @@ discard block | ||
| 298 | 298 |          foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { | 
| 299 | 299 |              if ($namespaceLevelNode instanceof ClassLike) { | 
| 300 | 300 | $classShortName = $namespaceLevelNode->name; | 
| 301 | - $className = $namespaceName ? $namespaceName .'\\' . $classShortName : $classShortName; | |
| 301 | + $className = $namespaceName ? $namespaceName.'\\'.$classShortName : $classShortName; | |
| 302 | 302 | |
| 303 | 303 |                  $namespaceLevelNode->setAttribute('fileName', $this->fileName); | 
| 304 | 304 | $classes[$className] = new ReflectionClass($className, $namespaceLevelNode); | 
| @@ -322,7 +322,7 @@ discard block | ||
| 322 | 322 |          foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { | 
| 323 | 323 |              if ($namespaceLevelNode instanceof Function_) { | 
| 324 | 324 | $funcShortName = $namespaceLevelNode->name; | 
| 325 | - $functionName = $namespaceName ? $namespaceName .'\\' . $funcShortName : $funcShortName; | |
| 325 | + $functionName = $namespaceName ? $namespaceName.'\\'.$funcShortName : $funcShortName; | |
| 326 | 326 | |
| 327 | 327 |                  $namespaceLevelNode->setAttribute('fileName', $this->fileName); | 
| 328 | 328 | $functions[$funcShortName] = new ReflectionFunction($functionName, $namespaceLevelNode); | 
| @@ -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; | 
| @@ -113,7 +113,7 @@ discard block | ||
| 113 | 113 | ++$this->nodeLevel; | 
| 114 | 114 | |
| 115 | 115 | $nodeType = $node->getType(); | 
| 116 | -            $methodName = 'resolve' . str_replace('_', '', $nodeType); | |
| 116 | +            $methodName = 'resolve'.str_replace('_', '', $nodeType); | |
| 117 | 117 |              if (method_exists($this, $methodName)) { | 
| 118 | 118 | $value = $this->$methodName($node); | 
| 119 | 119 | } | 
| @@ -144,7 +144,7 @@ discard block | ||
| 144 | 144 | protected function resolveScalarMagicConstMethod() | 
| 145 | 145 |      { | 
| 146 | 146 |          if ($this->context instanceof \ReflectionMethod) { | 
| 147 | - $fullName = $this->context->getDeclaringClass()->getName() . '::' . $this->context->getShortName(); | |
| 147 | + $fullName = $this->context->getDeclaringClass()->getName().'::'.$this->context->getShortName(); | |
| 148 | 148 | |
| 149 | 149 | return $fullName; | 
| 150 | 150 | } | 
| @@ -238,7 +238,7 @@ discard block | ||
| 238 | 238 | $fileNamespace = new ReflectionFileNamespace($fileName, $namespaceName); | 
| 239 | 239 |                  if ($fileNamespace->hasConstant($constantName)) { | 
| 240 | 240 | $constantValue = $fileNamespace->getConstant($constantName); | 
| 241 | - $constantName = $fileNamespace->getName() . '\\' . $constantName; | |
| 241 | + $constantName = $fileNamespace->getName().'\\'.$constantName; | |
| 242 | 242 | $isResolved = true; | 
| 243 | 243 | } | 
| 244 | 244 | } | 
| @@ -92,12 +92,12 @@ | ||
| 92 | 92 | $paramString = ''; | 
| 93 | 93 |          $identation  = str_repeat(' ', 4); | 
| 94 | 94 |          foreach ($methodParameters as $methodParameter) { | 
| 95 | -            $paramString .= "\n{$identation}" . $methodParameter; | |
| 95 | +            $paramString .= "\n{$identation}".$methodParameter; | |
| 96 | 96 | } | 
| 97 | 97 | |
| 98 | 98 | return sprintf( | 
| 99 | 99 |              "%sMethod [ <user%s%s%s>%s%s%s %s method %s ] {\n  @@ %s %d - %d{$paramFormat}\n}\n", | 
| 100 | - $this->getDocComment() ? $this->getDocComment() . "\n" : '', | |
| 100 | + $this->getDocComment() ? $this->getDocComment()."\n" : '', | |
| 101 | 101 |              $prototype ? ", overwrites {$prototypeClass}, prototype {$prototypeClass}" : '', | 
| 102 | 102 | $this->isConstructor() ? ', ctor' : '', | 
| 103 | 103 | $this->isDestructor() ? ', dtor' : '', | 
| @@ -130,7 +130,7 @@ discard block | ||
| 130 | 130 |          if ($isOptional) { | 
| 131 | 131 | $defaultValue = $this->getDefaultValue(); | 
| 132 | 132 |              if (is_string($defaultValue) && strlen($defaultValue) > 15) { | 
| 133 | - $defaultValue = substr($defaultValue, 0, 15) . '...'; | |
| 133 | + $defaultValue = substr($defaultValue, 0, 15).'...'; | |
| 134 | 134 | } | 
| 135 | 135 | /* @see https://3v4l.org/DJOEb for behaviour changes */ | 
| 136 | 136 |              if (is_double($defaultValue) && fmod($defaultValue, 1.0) === 0.0) { | 
| @@ -143,12 +143,12 @@ discard block | ||
| 143 | 143 | 'Parameter #%d [ %s %s%s%s%s$%s%s ]', | 
| 144 | 144 | $this->parameterIndex, | 
| 145 | 145 | ($this->isVariadic() || $isOptional) ? '<optional>' : '<required>', | 
| 146 | - $parameterType ? ltrim($parameterType, '\\') . ' ' : '', | |
| 146 | + $parameterType ? ltrim($parameterType, '\\').' ' : '', | |
| 147 | 147 | $isNullableParam ? 'or NULL ' : '', | 
| 148 | 148 | $this->isVariadic() ? '...' : '', | 
| 149 | 149 | $this->isPassedByReference() ? '&' : '', | 
| 150 | 150 | $this->getName(), | 
| 151 | -            $isOptional ? (' = ' . $defaultValue) : '' | |
| 151 | +            $isOptional ? (' = '.$defaultValue) : '' | |
| 152 | 152 | ); | 
| 153 | 153 | } | 
| 154 | 154 | |
| @@ -183,7 +183,7 @@ discard block | ||
| 183 | 183 |              if (!$parameterType instanceof Name\FullyQualified) { | 
| 184 | 184 |                  throw new ReflectionException("Can not resolve a class name for parameter"); | 
| 185 | 185 | } | 
| 186 | - $className = $parameterType->toString(); | |
| 186 | + $className = $parameterType->toString(); | |
| 187 | 187 | $classOrInterfaceExists = class_exists($className, false) || interface_exists($className, false); | 
| 188 | 188 | |
| 189 | 189 | return $classOrInterfaceExists ? new \ReflectionClass($className) : new ReflectionClass($className); |