@@ -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 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | /** |
| 33 | 33 | * Initializes reflection instance for given AST-node |
| 34 | 34 | * |
| 35 | - * @param string|\Closure $functionName The name of the function to reflect or a closure. |
|
| 35 | + * @param string $functionName The name of the function to reflect or a closure. |
|
| 36 | 36 | * @param Function_|null $functionNode Function node AST |
| 37 | 37 | */ |
| 38 | 38 | public function __construct($functionName, Function_ $functionNode = null) |
@@ -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) |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | /** |
| 30 | 30 | * Initializes reflection instance |
| 31 | 31 | * |
| 32 | - * @param string|object $argument Class name or instance of object |
|
| 32 | + * @param string|null $argument Class name or instance of object |
|
| 33 | 33 | * @param ClassLike $classLikeNode AST node for class |
| 34 | 34 | */ |
| 35 | 35 | public function __construct($argument, ClassLike $classLikeNode = null) |
@@ -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' : '', |
@@ -17,4 +17,4 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | ReflectionEngine::init(new ComposerLocator()); |
| 19 | 19 | |
| 20 | -require(__DIR__ . '/polyfill.php'); |
|
| 20 | +require(__DIR__.'/polyfill.php'); |
|
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $comments = $this->namespaceNode->getAttribute('comments'); |
| 181 | 181 | |
| 182 | 182 | if ($comments) { |
| 183 | - $docComment = (string)$comments[0]; |
|
| 183 | + $docComment = (string) $comments[0]; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | return $docComment; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
| 328 | 328 | if ($namespaceLevelNode instanceof ClassLike) { |
| 329 | 329 | $classShortName = $namespaceLevelNode->name; |
| 330 | - $className = $namespaceName ? $namespaceName .'\\' . $classShortName : $classShortName; |
|
| 330 | + $className = $namespaceName ? $namespaceName.'\\'.$classShortName : $classShortName; |
|
| 331 | 331 | |
| 332 | 332 | $namespaceLevelNode->setAttribute('fileName', $this->fileName); |
| 333 | 333 | $classes[$className] = new ReflectionClass($className, $namespaceLevelNode); |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
| 352 | 352 | if ($namespaceLevelNode instanceof Function_) { |
| 353 | 353 | $funcShortName = $namespaceLevelNode->name; |
| 354 | - $functionName = $namespaceName ? $namespaceName .'\\' . $funcShortName : $funcShortName; |
|
| 354 | + $functionName = $namespaceName ? $namespaceName.'\\'.$funcShortName : $funcShortName; |
|
| 355 | 355 | |
| 356 | 356 | $namespaceLevelNode->setAttribute('fileName', $this->fileName); |
| 357 | 357 | $functions[$funcShortName] = new ReflectionFunction($functionName, $namespaceLevelNode); |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
| 391 | 391 | if ($namespaceLevelNode instanceof FuncCall |
| 392 | 392 | && $namespaceLevelNode->name instanceof Name |
| 393 | - && (string)$namespaceLevelNode->name === 'define' |
|
| 393 | + && (string) $namespaceLevelNode->name === 'define' |
|
| 394 | 394 | ) { |
| 395 | 395 | $expressionSolver->process($namespaceLevelNode->args[0]->value); |
| 396 | 396 | $constantName = $expressionSolver->getValue(); |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | if ($hasDefaultValue) { |
| 129 | 129 | $defaultValue = $this->getDefaultValue(); |
| 130 | 130 | if (is_string($defaultValue) && strlen($defaultValue) > 15) { |
| 131 | - $defaultValue = substr($defaultValue, 0, 15) . '...'; |
|
| 131 | + $defaultValue = substr($defaultValue, 0, 15).'...'; |
|
| 132 | 132 | } |
| 133 | 133 | /* @see https://3v4l.org/DJOEb for behaviour changes */ |
| 134 | 134 | if (is_double($defaultValue) && fmod($defaultValue, 1.0) === 0.0) { |
| 135 | - $defaultValue = (int)$defaultValue; |
|
| 135 | + $defaultValue = (int) $defaultValue; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | $defaultValue = str_replace('\\\\', '\\', var_export($defaultValue, true)); |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | 'Parameter #%d [ %s %s%s%s$%s%s ]', |
| 143 | 143 | $this->parameterIndex, |
| 144 | 144 | $isOptional ? '<optional>' : '<required>', |
| 145 | - $parameterType ? ReflectionType::convertToDisplayType($parameterType) . ' ' : '', |
|
| 145 | + $parameterType ? ReflectionType::convertToDisplayType($parameterType).' ' : '', |
|
| 146 | 146 | $this->isVariadic() ? '...' : '', |
| 147 | 147 | $this->isPassedByReference() ? '&' : '', |
| 148 | 148 | $this->getName(), |
| 149 | - ($isOptional && $hasDefaultValue) ? (' = ' . $defaultValue) : '' |
|
| 149 | + ($isOptional && $hasDefaultValue) ? (' = '.$defaultValue) : '' |
|
| 150 | 150 | ); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | throw new ReflectionException("Can not resolve a class name for parameter"); |
| 198 | 198 | } |
| 199 | - $className = $parameterType->toString(); |
|
| 199 | + $className = $parameterType->toString(); |
|
| 200 | 200 | $classOrInterfaceExists = class_exists($className, false) || interface_exists($className, false); |
| 201 | 201 | |
| 202 | 202 | return $classOrInterfaceExists ? new \ReflectionClass($className) : new ReflectionClass($className); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | /** |
| 31 | 31 | * Has extension been loaded by PHP. |
| 32 | 32 | * |
| 33 | - * @return true |
|
| 33 | + * @return boolean |
|
| 34 | 34 | * Enabled extensions are always loaded. |
| 35 | 35 | */ |
| 36 | 36 | public function wasIncluded() |
@@ -312,6 +312,9 @@ |
||
| 312 | 312 | return new ReflectionExtension($extName); |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | + /** |
|
| 316 | + * @return string |
|
| 317 | + */ |
|
| 315 | 318 | public function getExtensionName() |
| 316 | 319 | { |
| 317 | 320 | if (!$this->classLikeNode) { |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - $buildString = function (array $items, $indentLevel = 4) { |
|
| 137 | + $buildString = function(array $items, $indentLevel = 4) { |
|
| 138 | 138 | if (!count($items)) { |
| 139 | 139 | return ''; |
| 140 | 140 | } |
| 141 | - $indent = "\n" . str_repeat(' ', $indentLevel); |
|
| 142 | - return $indent . implode($indent, explode("\n", implode("\n", $items))); |
|
| 141 | + $indent = "\n".str_repeat(' ', $indentLevel); |
|
| 142 | + return $indent.implode($indent, explode("\n", implode("\n", $items))); |
|
| 143 | 143 | }; |
| 144 | - $buildConstants = function (array $items, $indentLevel = 4) { |
|
| 144 | + $buildConstants = function(array $items, $indentLevel = 4) { |
|
| 145 | 145 | $str = ''; |
| 146 | 146 | foreach ($items as $name => $value) { |
| 147 | - $str .= "\n" . str_repeat(' ', $indentLevel); |
|
| 147 | + $str .= "\n".str_repeat(' ', $indentLevel); |
|
| 148 | 148 | $str .= sprintf( |
| 149 | 149 | 'Constant [ %s %s ] { %s }', |
| 150 | 150 | gettype($value), |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | ($isObject ? 'Object of class' : 'Class'), |
| 169 | 169 | $modifiers, |
| 170 | 170 | $this->getName(), |
| 171 | - false !== $parentClass ? (' extends ' . $parentClass->getName()) : '', |
|
| 172 | - $interfaceNames ? (' implements ' . implode(', ', $interfaceNames)) : '', |
|
| 171 | + false !== $parentClass ? (' extends '.$parentClass->getName()) : '', |
|
| 172 | + $interfaceNames ? (' implements '.implode(', ', $interfaceNames)) : '', |
|
| 173 | 173 | $this->getFileName(), |
| 174 | 174 | $this->getStartLine(), |
| 175 | 175 | $this->getEndLine(), |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | if (!isset($this->constants)) { |
| 212 | 212 | if ($this->classLikeNode) { |
| 213 | - $this->constants = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance) { |
|
| 213 | + $this->constants = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance) { |
|
| 214 | 214 | $result += $instance->getConstants(); |
| 215 | 215 | }); |
| 216 | 216 | $this->collectSelfConstants(); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $staticOrder = [true, false]; |
| 257 | 257 | foreach ($staticOrder as $shouldBeStatic) { |
| 258 | 258 | foreach ($properties as $property) { |
| 259 | - $isStaticProperty = $property->isStatic(); |
|
| 259 | + $isStaticProperty = $property->isStatic(); |
|
| 260 | 260 | if ($shouldBeStatic !== $isStaticProperty) { |
| 261 | 261 | continue; |
| 262 | 262 | } |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | { |
| 348 | 348 | if (!isset($this->interfaceClasses)) { |
| 349 | 349 | if ($this->classLikeNode) { |
| 350 | - $this->interfaceClasses = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance) { |
|
| 350 | + $this->interfaceClasses = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance) { |
|
| 351 | 351 | if ($instance->isInterface()) { |
| 352 | 352 | $result[$instance->name] = $instance; |
| 353 | 353 | } |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | if (!isset($this->methods)) { |
| 395 | 395 | if ($this->classLikeNode) { |
| 396 | 396 | $directMethods = ReflectionMethod::collectFromClassNode($this->classLikeNode, $this); |
| 397 | - $parentMethods = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) { |
|
| 397 | + $parentMethods = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) { |
|
| 398 | 398 | $reflectionMethods = []; |
| 399 | 399 | foreach ($instance->getMethods() as $reflectionMethod) { |
| 400 | 400 | if (!$isParent || !$reflectionMethod->isPrivate()) { |
@@ -479,9 +479,9 @@ discard block |
||
| 479 | 479 | */ |
| 480 | 480 | public function getName() |
| 481 | 481 | { |
| 482 | - $namespaceName = $this->namespaceName ? $this->namespaceName . '\\' : ''; |
|
| 482 | + $namespaceName = $this->namespaceName ? $this->namespaceName.'\\' : ''; |
|
| 483 | 483 | |
| 484 | - return $namespaceName . $this->getShortName(); |
|
| 484 | + return $namespaceName.$this->getShortName(); |
|
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | /** |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | if (!isset($this->properties)) { |
| 536 | 536 | if ($this->classLikeNode) { |
| 537 | 537 | $directProperties = ReflectionProperty::collectFromClassNode($this->classLikeNode, $this->getName()); |
| 538 | - $parentProperties = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) { |
|
| 538 | + $parentProperties = $this->recursiveCollect(function(array &$result, \ReflectionClass $instance, $isParent) { |
|
| 539 | 539 | $reflectionProperties = []; |
| 540 | 540 | foreach ($instance->getProperties() as $reflectionProperty) { |
| 541 | 541 | if (!$isParent || !$reflectionProperty->isPrivate()) { |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | break; |
| 635 | 635 | } |
| 636 | 636 | } |
| 637 | - $aliases[$adaptation->newName] = $traitName . '::'. $methodName; |
|
| 637 | + $aliases[$adaptation->newName] = $traitName.'::'.$methodName; |
|
| 638 | 638 | } |
| 639 | 639 | } |
| 640 | 640 | |