@@ -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 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | //for some reason, ReflectionMethod->getNamespaceName in php always returns '', so we shouldn't use it too |
| 57 | 57 | $this->className = $className; |
| 58 | 58 | $this->declaringClass = $declaringClass; |
| 59 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 59 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 60 | 60 | $this->functionLikeNode = $classMethodNode ?: $this->reflectionParser->parseClassMethod($className, $methodName); |
| 61 | 61 | |
| 62 | 62 | // Let's unset original read-only properties to have a control over them via __get |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | public function getDeclaringClass() |
| 138 | 138 | { |
| 139 | 139 | return isset($this->declaringClass) |
| 140 | - ? $this->declaringClass |
|
| 141 | - : $this->reflectionParser->getClassReflection($this->className); |
|
| 140 | + ? $this->declaringClass |
|
| 141 | + : $this->reflectionParser->getClassReflection($this->className); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | ReflectionParser $reflectionParser = null |
| 69 | 69 | ) { |
| 70 | 70 | $this->className = $className; |
| 71 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 71 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 72 | 72 | if (!$propertyType || !$propertyNode) { |
| 73 | 73 | list ($propertyType, $propertyNode) = $this->reflectionParser->parseClassProperty($className, $propertyName); |
| 74 | 74 | } |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | PropertyProperty $propertyNode = null, |
| 68 | 68 | ReflectionParser $reflectionParser = null |
| 69 | 69 | ) { |
| 70 | - $this->className = $className; |
|
| 70 | + $this->className = $className; |
|
| 71 | 71 | $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
| 72 | 72 | if (!$propertyType || !$propertyNode) { |
| 73 | 73 | list ($propertyType, $propertyNode) = $this->reflectionParser->parseClassProperty($className, $propertyName); |
@@ -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) |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | $this->parameterNode = $parameterNode; |
| 96 | 96 | $this->parameterIndex = $parameterIndex; |
| 97 | 97 | $this->declaringFunction = $declaringFunction; |
| 98 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 98 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 99 | 99 | |
| 100 | 100 | if ($this->isDefaultValueAvailable()) { |
| 101 | 101 | if ($declaringFunction instanceof \ReflectionMethod) { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $this->parameterNode = $parameterNode; |
| 96 | 96 | $this->parameterIndex = $parameterIndex; |
| 97 | 97 | $this->declaringFunction = $declaringFunction; |
| 98 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 98 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 99 | 99 | |
| 100 | 100 | if ($this->isDefaultValueAvailable()) { |
| 101 | 101 | if ($declaringFunction instanceof \ReflectionMethod) { |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | if ($hasDefaultValue) { |
| 137 | 137 | $defaultValue = $this->getDefaultValue(); |
| 138 | 138 | if (is_string($defaultValue) && strlen($defaultValue) > 15) { |
| 139 | - $defaultValue = substr($defaultValue, 0, 15) . '...'; |
|
| 139 | + $defaultValue = substr($defaultValue, 0, 15).'...'; |
|
| 140 | 140 | } |
| 141 | 141 | /* @see https://3v4l.org/DJOEb for behaviour changes */ |
| 142 | 142 | if (is_double($defaultValue) && fmod($defaultValue, 1.0) === 0.0) { |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | 'Parameter #%d [ %s %s%s%s$%s%s ]', |
| 151 | 151 | $this->parameterIndex, |
| 152 | 152 | $isOptional ? '<optional>' : '<required>', |
| 153 | - $parameterType ? ReflectionType::convertToDisplayType($parameterType) . ' ' : '', |
|
| 153 | + $parameterType ? ReflectionType::convertToDisplayType($parameterType).' ' : '', |
|
| 154 | 154 | $this->isVariadic() ? '...' : '', |
| 155 | 155 | $this->isPassedByReference() ? '&' : '', |
| 156 | 156 | $this->getName(), |
| 157 | - ($isOptional && $hasDefaultValue) ? (' = ' . $defaultValue) : '' |
|
| 157 | + ($isOptional && $hasDefaultValue) ? (' = '.$defaultValue) : '' |
|
| 158 | 158 | ); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | throw new ReflectionException("Can not resolve a class name for parameter"); |
| 206 | 206 | } |
| 207 | - $className = $parameterType->toString(); |
|
| 207 | + $className = $parameterType->toString(); |
|
| 208 | 208 | return $this->reflectionParser->getClassReflection($className); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | public static function init(LocatorInterface $locator) |
| 51 | 51 | { |
| 52 | 52 | self::$locator = $locator; |
| 53 | - self::$reflectionParser = new ReflectionParser($locator); |
|
| 54 | - self::$reflectionParser->initStaticEngine( |
|
| 55 | - self::$parsedFiles, |
|
| 56 | - self::$maximumCachedFiles, |
|
| 57 | - self::$parser, |
|
| 58 | - self::$traverser |
|
| 59 | - ); |
|
| 53 | + self::$reflectionParser = new ReflectionParser($locator); |
|
| 54 | + self::$reflectionParser->initStaticEngine( |
|
| 55 | + self::$parsedFiles, |
|
| 56 | + self::$maximumCachedFiles, |
|
| 57 | + self::$parser, |
|
| 58 | + self::$traverser |
|
| 59 | + ); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public static function getReflectionParser() |
| 66 | 66 | { |
| 67 | - return self::$reflectionParser; |
|
| 67 | + return self::$reflectionParser; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public static function setMaximumCachedFiles($newLimit) |
| 78 | 78 | { |
| 79 | - self::$reflectionParser->setMaximumCachedFiles($newLimit); |
|
| 79 | + self::$reflectionParser->setMaximumCachedFiles($newLimit); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | { |
| 59 | 59 | $fileName = PathResolver::realpath($fileName); |
| 60 | 60 | $this->fileName = $fileName; |
| 61 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 61 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 62 | 62 | $this->topLevelNodes = $topLevelNodes ?: $this->reflectionParser->parseFile($fileName); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | public function __construct($fileName, $namespaceName, Namespace_ $namespaceNode = null, ReflectionParser $reflectionParser = null) |
| 91 | 91 | { |
| 92 | 92 | $fileName = PathResolver::realpath($fileName); |
| 93 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 93 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 94 | 94 | if (!$namespaceNode) { |
| 95 | 95 | $namespaceNode = $this->reflectionParser->parseFileNamespace($fileName, $namespaceName); |
| 96 | 96 | } |
@@ -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(); |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | unset($this->name); |
| 42 | 42 | |
| 43 | 43 | $this->namespaceName = join('\\', $namespaceParts); |
| 44 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 44 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 45 | 45 | |
| 46 | 46 | $this->classLikeNode = $classLikeNode ?: $this->reflectionParser->parseClass($fullClassName); |
| 47 | 47 | } |