@@ -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 | public function __construct( |
| 31 | 31 | private string $attributeName, |
| 32 | - private ReflectionClass|ReflectionMethod|ReflectionProperty|ReflectionClassConstant|ReflectionFunction|ReflectionParameter $reflector, |
|
| 32 | + private ReflectionClass | ReflectionMethod | ReflectionProperty | ReflectionClassConstant | ReflectionFunction | ReflectionParameter $reflector, |
|
| 33 | 33 | private array $arguments, |
| 34 | 34 | private bool $isRepeated, |
| 35 | 35 | ) { |
@@ -49,9 +49,9 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | public function __toString(): string |
| 51 | 51 | { |
| 52 | - $allowsNull = $this->allowsNull && !in_array($this->type,['null', 'mixed'], true); |
|
| 52 | + $allowsNull = $this->allowsNull && !in_array($this->type, ['null', 'mixed'], true); |
|
| 53 | 53 | |
| 54 | - return $allowsNull ? '?' . $this->type : $this->type; |
|
| 54 | + return $allowsNull ? '?'.$this->type : $this->type; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * Initializes reflection data |
| 29 | 29 | */ |
| 30 | - public function __construct(ReflectionNamedType|ReflectionIntersectionType ...$types) |
|
| 30 | + public function __construct(ReflectionNamedType | ReflectionIntersectionType ...$types) |
|
| 31 | 31 | { |
| 32 | 32 | $this->types = $types; |
| 33 | 33 | } |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function __toString(): string |
| 54 | 54 | { |
| 55 | - $stringTypes = array_map(function(ReflectionNamedType|ReflectionIntersectionType $type) { |
|
| 55 | + $stringTypes = array_map(function(ReflectionNamedType | ReflectionIntersectionType $type) { |
|
| 56 | 56 | return match (true) { |
| 57 | 57 | $type instanceof ReflectionNamedType => $type->getName(), |
| 58 | - $type instanceof ReflectionIntersectionType => '(' . $type . ')', |
|
| 58 | + $type instanceof ReflectionIntersectionType => '('.$type.')', |
|
| 59 | 59 | }; |
| 60 | 60 | }, $this->types); |
| 61 | 61 | |
@@ -22,5 +22,5 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @param string $className Name of the class (with or without leading '\' FQCN) |
| 24 | 24 | */ |
| 25 | - public function locateClass(string $className): false|string; |
|
| 25 | + public function locateClass(string $className): false | string; |
|
| 26 | 26 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | public function getClass(string $className): ReflectionClass |
| 92 | 92 | { |
| 93 | 93 | if (!$this->hasClass($className)) { |
| 94 | - throw new ReflectionException("Could not find the class " . $className . " in the file " . $this->fileName); |
|
| 94 | + throw new ReflectionException("Could not find the class ".$className." in the file ".$this->fileName); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return $this->fileClasses[$className]; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | public function getConstant(string $constantName): mixed |
| 120 | 120 | { |
| 121 | 121 | if (!$this->hasConstant($constantName)) { |
| 122 | - throw new ReflectionException("Could not find the constant " . $constantName . " in the file " . $this->fileName); |
|
| 122 | + throw new ReflectionException("Could not find the constant ".$constantName." in the file ".$this->fileName); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $this->fileConstants[$constantName]; |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | /** |
| 151 | 151 | * Gets doc comments from a namespace node if it exists, otherwise "false" |
| 152 | 152 | */ |
| 153 | - public function getDocComment(): string|false |
|
| 153 | + public function getDocComment(): string | false |
|
| 154 | 154 | { |
| 155 | 155 | $docComment = false; |
| 156 | 156 | $comments = $this->namespaceNode->getAttribute('comments'); |
| 157 | 157 | |
| 158 | 158 | if ($comments) { |
| 159 | - $docComment = (string)$comments[0]; |
|
| 159 | + $docComment = (string) $comments[0]; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | return $docComment; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | /** |
| 166 | 166 | * Gets starting line number or false if information is not available |
| 167 | 167 | */ |
| 168 | - public function getEndLine(): int|false |
|
| 168 | + public function getEndLine(): int | false |
|
| 169 | 169 | { |
| 170 | 170 | if ($this->namespaceNode->hasAttribute('endLine')) { |
| 171 | 171 | return $this->namespaceNode->getAttribute('endLine'); |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | public function getFunction(string $functionName): ReflectionFunction |
| 191 | 191 | { |
| 192 | 192 | if (!$this->hasFunction($functionName)) { |
| 193 | - throw new ReflectionException("Could not find the function " . $functionName . " in the file " . $this->fileName); |
|
| 193 | + throw new ReflectionException("Could not find the function ".$functionName." in the file ".$this->fileName); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | return $this->fileFunctions[$functionName]; |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | /** |
| 260 | 260 | * Gets starting line number or false if information is not available |
| 261 | 261 | */ |
| 262 | - public function getStartLine(): int|false |
|
| 262 | + public function getStartLine(): int | false |
|
| 263 | 263 | { |
| 264 | 264 | if ($this->namespaceNode->hasAttribute('startLine')) { |
| 265 | 265 | return $this->namespaceNode->getAttribute('startLine'); |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
| 312 | 312 | if ($namespaceLevelNode instanceof ClassLike) { |
| 313 | 313 | $classShortName = $namespaceLevelNode->name->toString(); |
| 314 | - $className = $namespaceName ? $namespaceName .'\\' . $classShortName : $classShortName; |
|
| 314 | + $className = $namespaceName ? $namespaceName.'\\'.$classShortName : $classShortName; |
|
| 315 | 315 | |
| 316 | 316 | $namespaceLevelNode->setAttribute('fileName', $this->fileName); |
| 317 | 317 | $classes[$className] = new ReflectionClass($className, $namespaceLevelNode); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | foreach ($this->namespaceNode->stmts as $namespaceLevelNode) { |
| 336 | 336 | if ($namespaceLevelNode instanceof Function_) { |
| 337 | 337 | $funcShortName = $namespaceLevelNode->name->toString(); |
| 338 | - $functionName = $namespaceName ? $namespaceName .'\\' . $funcShortName : $funcShortName; |
|
| 338 | + $functionName = $namespaceName ? $namespaceName.'\\'.$funcShortName : $funcShortName; |
|
| 339 | 339 | |
| 340 | 340 | $namespaceLevelNode->setAttribute('fileName', $this->fileName); |
| 341 | 341 | $functions[$funcShortName] = new ReflectionFunction($functionName, $namespaceLevelNode); |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | if ($namespaceLevelNode instanceof Expression |
| 374 | 374 | && $namespaceLevelNode->expr instanceof FuncCall |
| 375 | 375 | && $namespaceLevelNode->expr->name instanceof Name |
| 376 | - && (string)$namespaceLevelNode->expr->name === 'define' |
|
| 376 | + && (string) $namespaceLevelNode->expr->name === 'define' |
|
| 377 | 377 | ) { |
| 378 | 378 | try { |
| 379 | 379 | $functionCallNode = $namespaceLevelNode->expr; |
@@ -113,20 +113,20 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $fileString = ''; |
| 115 | 115 | if ($this->getFileName()) { |
| 116 | - $fileString .= "\n @@ " . $this->getFileName(); |
|
| 117 | - $fileString .= ' ' . $this->getStartLine(); |
|
| 118 | - $fileString .= ' - ' . $this->getEndLine(); |
|
| 116 | + $fileString .= "\n @@ ".$this->getFileName(); |
|
| 117 | + $fileString .= ' '.$this->getStartLine(); |
|
| 118 | + $fileString .= ' - '.$this->getEndLine(); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $paramString = ''; |
| 122 | 122 | $indentation = str_repeat(' ', 4); |
| 123 | 123 | foreach ($methodParameters as $methodParameter) { |
| 124 | - $paramString .= "\n{$indentation}" . $methodParameter; |
|
| 124 | + $paramString .= "\n{$indentation}".$methodParameter; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | return sprintf( |
| 128 | 128 | "%sMethod [ <%s%s%s>%s%s%s %s method %s ] {%s{$paramFormat}{$returnFormat}\n}\n", |
| 129 | - $this->getDocComment() ? $this->getDocComment() . "\n" : '', |
|
| 129 | + $this->getDocComment() ? $this->getDocComment()."\n" : '', |
|
| 130 | 130 | $this->isInternal() ? 'internal' : 'user', |
| 131 | 131 | $protoString, |
| 132 | 132 | $this->isConstructor() ? ', ctor' : '', |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - throw new ReflectionException("Method " . $this->getDeclaringClass()->getName() . "::" . $methodName . "() does not have prototype"); |
|
| 215 | + throw new ReflectionException("Method ".$this->getDeclaringClass()->getName()."::".$methodName."() does not have prototype"); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | public function hasPrototype(): bool |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | * @param object|string $argument Class name or instance of object |
| 39 | 39 | * @param ?ClassLike $classLikeNode AST node for class |
| 40 | 40 | */ |
| 41 | - public function __construct(object|string $argument, ?ClassLike $classLikeNode = null) |
|
| 41 | + public function __construct(object | string $argument, ?ClassLike $classLikeNode = null) |
|
| 42 | 42 | { |
| 43 | 43 | $fullClassName = is_object($argument) ? get_class($argument) : ltrim($argument, '\\'); |
| 44 | 44 | $namespaceParts = explode('\\', $fullClassName); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | use InitializationTrait; |
| 37 | 37 | |
| 38 | - protected FunctionLike|Function_|ClassMethod $functionLikeNode; |
|
| 38 | + protected FunctionLike | Function_ | ClassMethod $functionLikeNode; |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Namespace name |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | return parent::getClosureThis(); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function getDocComment(): string|false |
|
| 70 | + public function getDocComment(): string | false |
|
| 71 | 71 | { |
| 72 | 72 | $docComment = $this->functionLikeNode->getDocComment(); |
| 73 | 73 | |
| 74 | 74 | return $docComment ? $docComment->getText() : false; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function getEndLine(): int|false |
|
| 77 | + public function getEndLine(): int | false |
|
| 78 | 78 | { |
| 79 | 79 | if ($this->functionLikeNode->hasAttribute('endLine')) { |
| 80 | 80 | return $this->functionLikeNode->getAttribute('endLine'); |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | return null; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function getExtensionName(): string|false |
|
| 91 | + public function getExtensionName(): string | false |
|
| 92 | 92 | { |
| 93 | 93 | return false; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function getFileName(): string|false |
|
| 96 | + public function getFileName(): string | false |
|
| 97 | 97 | { |
| 98 | 98 | if ($this->functionLikeNode->hasAttribute('fileName')) { |
| 99 | 99 | return $this->functionLikeNode->getAttribute('fileName'); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | if ($this->functionLikeNode instanceof Function_ || $this->functionLikeNode instanceof ClassMethod) { |
| 111 | 111 | $functionName = $this->functionLikeNode->name->toString(); |
| 112 | 112 | |
| 113 | - return $this->namespaceName ? $this->namespaceName . '\\' . $functionName : $functionName; |
|
| 113 | + return $this->namespaceName ? $this->namespaceName.'\\'.$functionName : $functionName; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | return ''; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | foreach ($this->functionLikeNode->getParams() as $parameterIndex => $parameterNode) { |
| 163 | 163 | $reflectionParameter = new ReflectionParameter( |
| 164 | 164 | $this->getName(), |
| 165 | - (string)$parameterNode->var->name, |
|
| 165 | + (string) $parameterNode->var->name, |
|
| 166 | 166 | $parameterNode, |
| 167 | 167 | $parameterIndex, |
| 168 | 168 | $this |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * |
| 183 | 183 | * @link http://php.net/manual/en/reflectionfunctionabstract.getreturntype.php |
| 184 | 184 | */ |
| 185 | - public function getReturnType(): \ReflectionNamedType|\ReflectionUnionType|\ReflectionIntersectionType|null |
|
| 185 | + public function getReturnType(): \ReflectionNamedType | \ReflectionUnionType | \ReflectionIntersectionType | null |
|
| 186 | 186 | { |
| 187 | 187 | if ($this->hasReturnType()) { |
| 188 | 188 | $typeResolver = new TypeExpressionResolver($this); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | throw new ReflectionException('unable to get short name'); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - public function getStartLine(): int|false |
|
| 209 | + public function getStartLine(): int | false |
|
| 210 | 210 | { |
| 211 | 211 | if ($this->functionLikeNode->attrGroups !== []) { |
| 212 | 212 | $attrGroups = $this->functionLikeNode->attrGroups; |