@@ -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; |
@@ -120,13 +120,13 @@ |
||
| 120 | 120 | |
| 121 | 121 | return sprintf( |
| 122 | 122 | $reflectionFormat, |
| 123 | - $this->getDocComment() ? $this->getDocComment() . "\n" : '', |
|
| 123 | + $this->getDocComment() ? $this->getDocComment()."\n" : '', |
|
| 124 | 124 | $this->getName(), |
| 125 | 125 | $this->getFileName(), |
| 126 | 126 | $this->getStartLine(), |
| 127 | 127 | $this->getEndLine(), |
| 128 | 128 | count($this->getParameters()), |
| 129 | - array_reduce($this->getParameters(), static fn($str, ReflectionParameter $param) => $str . "\n " . $param, '') |
|
| 129 | + array_reduce($this->getParameters(), static fn($str, ReflectionParameter $param) => $str."\n ".$param, '') |
|
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -67,14 +67,14 @@ |
||
| 67 | 67 | if ($type instanceof ReflectionNamedType) { |
| 68 | 68 | $displayType = $type->getName(); |
| 69 | 69 | } else { |
| 70 | - $displayType = (string)$type; |
|
| 70 | + $displayType = (string) $type; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $displayType = ltrim($displayType, '\\'); |
| 74 | 74 | |
| 75 | 75 | $specialNullableTypes = in_array($displayType, ['mixed', 'null'], true); |
| 76 | 76 | if ($type->allowsNull() && !$type instanceof ReflectionUnionType && !$specialNullableTypes) { |
| 77 | - $displayType = '?' . $displayType; |
|
| 77 | + $displayType = '?'.$displayType; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return $displayType; |
@@ -34,15 +34,15 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * Concrete class constant node |
| 36 | 36 | */ |
| 37 | - private ClassConst|EnumCase $classConstOrEnumCaseNode; |
|
| 37 | + private ClassConst | EnumCase $classConstOrEnumCaseNode; |
|
| 38 | 38 | |
| 39 | - private Const_|EnumCase $constOrEnumCaseNode; |
|
| 39 | + private Const_ | EnumCase $constOrEnumCaseNode; |
|
| 40 | 40 | |
| 41 | 41 | private string $className; |
| 42 | 42 | |
| 43 | 43 | private mixed $value = null; |
| 44 | 44 | |
| 45 | - private \ReflectionUnionType|\ReflectionNamedType|\ReflectionIntersectionType|null $type = null; |
|
| 45 | + private \ReflectionUnionType | \ReflectionNamedType | \ReflectionIntersectionType | null $type = null; |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Parses class constants from the concrete class node |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | public function __construct( |
| 87 | 87 | string $className, |
| 88 | 88 | string $classConstantName, |
| 89 | - ClassConst|EnumCase|null $classConstNode = null, |
|
| 90 | - Const_|EnumCase|null $constNode = null |
|
| 89 | + ClassConst | EnumCase | null $classConstNode = null, |
|
| 90 | + Const_ | EnumCase | null $constNode = null |
|
| 91 | 91 | ) { |
| 92 | 92 | $this->className = ltrim($className, '\\'); |
| 93 | 93 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | /** |
| 142 | 142 | * @inheritDoc |
| 143 | 143 | */ |
| 144 | - public function getDocComment(): string|false |
|
| 144 | + public function getDocComment(): string | false |
|
| 145 | 145 | { |
| 146 | 146 | $docBlock = $this->classConstOrEnumCaseNode->getDocComment(); |
| 147 | 147 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | ]; |
| 256 | 256 | $value = $this->isEnumCase() ? 'Object' : $this->getValue(); |
| 257 | 257 | if (!$this->hasType()) { |
| 258 | - $type = gettype($value); |
|
| 258 | + $type = gettype($value); |
|
| 259 | 259 | if (isset($typeMap[$type])) { |
| 260 | 260 | $type = $typeMap[$type]; |
| 261 | 261 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | ); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - public function getNode(): ClassConst|EnumCase |
|
| 281 | + public function getNode(): ClassConst | EnumCase |
|
| 282 | 282 | { |
| 283 | 283 | return $this->classConstOrEnumCaseNode; |
| 284 | 284 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | * |
| 36 | 36 | * @param string $className Name of the class |
| 37 | 37 | */ |
| 38 | - public function locateClass(string $className): false|string |
|
| 38 | + public function locateClass(string $className): false | string |
|
| 39 | 39 | { |
| 40 | 40 | return call_user_func($this->callable, ltrim($className, '\\')); |
| 41 | 41 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | * |
| 51 | 51 | * @param string $className Name of the class |
| 52 | 52 | **/ |
| 53 | - public function locateClass(string $className): false|string |
|
| 53 | + public function locateClass(string $className): false | string |
|
| 54 | 54 | { |
| 55 | 55 | $filePath = $this->loader->findFile(ltrim($className, '\\')); |
| 56 | 56 | if (!empty($filePath)) { |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | private ?string $defaultValueConstExpr; |
| 76 | 76 | |
| 77 | - private \ReflectionUnionType|\ReflectionNamedType|\ReflectionIntersectionType|null $type = null; |
|
| 77 | + private \ReflectionUnionType | \ReflectionNamedType | \ReflectionIntersectionType | null $type = null; |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Initializes a reflection for the property |
| 81 | 81 | */ |
| 82 | 82 | public function __construct( |
| 83 | - string|array $unusedFunctionName, |
|
| 83 | + string | array $unusedFunctionName, |
|
| 84 | 84 | string $parameterName, |
| 85 | 85 | Param $parameterNode, |
| 86 | 86 | int $parameterIndex, |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | public function __debugInfo(): array |
| 136 | 136 | { |
| 137 | 137 | return [ |
| 138 | - 'name' => (string)$this->parameterNode->var->name, |
|
| 138 | + 'name' => (string) $this->parameterNode->var->name, |
|
| 139 | 139 | ]; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | // For constant fetch expressions, PHP renders now expression |
| 153 | 153 | if ($this->isDefaultValueConstExpr) { |
| 154 | 154 | $defaultValue = $this->defaultValueConstExpr; |
| 155 | - } elseif ($this->isDefaultValueConstant){ |
|
| 155 | + } elseif ($this->isDefaultValueConstant) { |
|
| 156 | 156 | $defaultValue = $this->defaultValueConstantName; |
| 157 | 157 | } else { |
| 158 | 158 | $defaultValue = var_export($this->getDefaultValue(), true); |
@@ -163,11 +163,11 @@ discard block |
||
| 163 | 163 | 'Parameter #%d [ %s %s%s%s$%s%s ]', |
| 164 | 164 | $this->parameterIndex, |
| 165 | 165 | $isOptional ? '<optional>' : '<required>', |
| 166 | - $parameterType ? ReflectionType::convertToDisplayType($parameterType) . ' ' : '', |
|
| 166 | + $parameterType ? ReflectionType::convertToDisplayType($parameterType).' ' : '', |
|
| 167 | 167 | $this->isVariadic() ? '...' : '', |
| 168 | 168 | $this->isPassedByReference() ? '&' : '', |
| 169 | 169 | $this->getName(), |
| 170 | - ($isOptional && $hasDefaultValue) ? (' = ' . $defaultValue) : '' |
|
| 170 | + ($isOptional && $hasDefaultValue) ? (' = '.$defaultValue) : '' |
|
| 171 | 171 | ); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | /** |
| 263 | 263 | * {@inheritDoc} |
| 264 | 264 | */ |
| 265 | - public function getDefaultValueConstantName(): null|string |
|
| 265 | + public function getDefaultValueConstantName(): null | string |
|
| 266 | 266 | { |
| 267 | 267 | if (!$this->isDefaultValueAvailable()) { |
| 268 | 268 | throw new ReflectionException('Internal error: Failed to retrieve the default value'); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | public function getName(): string |
| 278 | 278 | { |
| 279 | - return (string)$this->parameterNode->var->name; |
|
| 279 | + return (string) $this->parameterNode->var->name; |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /** |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | /** |
| 291 | 291 | * @inheritDoc |
| 292 | 292 | */ |
| 293 | - public function getType(): \ReflectionNamedType|\ReflectionUnionType|\ReflectionIntersectionType|null |
|
| 293 | + public function getType(): \ReflectionNamedType | \ReflectionUnionType | \ReflectionIntersectionType | null |
|
| 294 | 294 | { |
| 295 | 295 | return $this->type; |
| 296 | 296 | } |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | return $this->fileNamespaces[$namespaceName]; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - throw new ReflectionException("Could not find the namespace " . $namespaceName . " in the file " . $this->fileName); |
|
| 69 | + throw new ReflectionException("Could not find the namespace ".$namespaceName." in the file ".$this->fileName); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -13,8 +13,8 @@ |
||
| 13 | 13 | |
| 14 | 14 | return RectorConfig::configure() |
| 15 | 15 | ->withPaths([ |
| 16 | - __DIR__ . '/src', |
|
| 17 | - __DIR__ . '/tests', |
|
| 16 | + __DIR__.'/src', |
|
| 17 | + __DIR__.'/tests', |
|
| 18 | 18 | ]) |
| 19 | 19 | // uncomment to reach your current PHP version |
| 20 | 20 | // ->withPhpSets() |