From 621348f9eae9bfe763300fbc0a45327368046e3c Mon Sep 17 00:00:00 2001 From: TomasVotruba <924196+TomasVotruba@users.noreply.github.com> Date: Sun, 5 Jul 2026 01:01:31 +0000 Subject: [PATCH] [automated] Apply Coding Standard --- config/set/php72.php | 2 +- config/set/php74.php | 2 +- ...catedMethodCallReplacementResolverTest.php | 2 +- .../config/configured_rule.php | 3 +- .../ArgumentDefaultValueReplacer.php | 6 ++-- .../NodeAnalyzer/ArgumentAddingScope.php | 2 +- .../ClassMethod/ArgumentAdderRector.php | 12 +++---- .../ReplaceArgumentDefaultValueRector.php | 2 +- rules/Arguments/ValueObject/ArgumentAdder.php | 2 +- .../ArgumentAdderWithoutDefaultValue.php | 2 +- .../NodeManipulator/NamedArgsSorter.php | 2 +- .../Class_/ConvertStaticToSelfRector.php | 2 +- .../Foreach_/ForeachToInArrayRector.php | 2 +- .../Rector/If_/ExplicitBoolCompareRector.php | 16 ++++----- rules/CodingStyle/Naming/ClassNaming.php | 2 +- .../FuncGetArgsToVariadicParamRector.php | 8 ++--- .../NewlineBeforeNewAssignSetRector.php | 6 ++-- ...CountArrayToEmptyArrayComparisonRector.php | 4 +-- ...VersionCompareFuncCallToConstantRector.php | 2 +- .../PostInc/PostIncDecToPreIncDecRector.php | 2 +- rules/DeadCode/ConditionEvaluator.php | 2 +- .../IsClassMethodUsedAnalyzer.php | 3 +- .../NodeManipulator/LivingCodeManipulator.php | 2 +- .../PhpDoc/TagRemover/VarTagRemover.php | 2 +- .../RemovePhpVersionIdCheckRector.php | 2 +- .../RemoveDeadZeroAndOneOperationRector.php | 4 +-- .../UselessIfCondBeforeForeachDetector.php | 2 +- .../Rector/If_/RemoveAlwaysElseRector.php | 4 +-- .../Guard/BreakingVariableRenameGuard.php | 6 ++-- rules/Naming/Matcher/CallMatcher.php | 2 +- .../Matcher/VariableAndCallAssignMatcher.php | 3 +- .../Naming/Naming/ConflictingNameResolver.php | 8 ++--- rules/Naming/Naming/ExpectedNameResolver.php | 4 +-- .../OverriddenExistingNamesResolver.php | 4 +-- rules/Naming/Naming/PropertyNaming.php | 4 +-- .../NamingConventionAnalyzer.php | 2 +- .../RenameParamToMatchTypeRector.php | 3 +- .../ValueObject/VariableAndCallAssign.php | 8 ++--- .../ValueObject/VariableAndCallForeach.php | 8 ++--- .../Switch_/ContinueToBreakInSwitchRector.php | 2 +- .../Break_/RemoveZeroBreakContinueRector.php | 2 +- rules/Php70/EregToPcreTransformer.php | 3 +- .../FuncCall/RemoveExtraParametersRector.php | 4 +-- .../NodeFactory/AnonymousFunctionFactory.php | 2 +- ...laceEachAssignmentWithKeyCurrentRector.php | 2 +- .../NodeAnalyzer/PhpAttributeAnalyzer.php | 4 +-- .../StrStartsWithFuncCallFactory.php | 2 +- .../StrFalseComparisonResolver.php | 2 +- .../Rector/Identical/StrEndsWithRector.php | 6 ++-- .../Property/ReadOnlyPropertyRector.php | 2 +- .../NodeManipulator/VisibilityManipulator.php | 34 +++++++++---------- .../ClassMethod/ArgumentRemoverRector.php | 6 ++-- ...FuncCallStaticCallToMethodCallAnalyzer.php | 4 +-- ...AutowiredClassMethodOrPropertyAnalyzer.php | 2 +- .../NodeAnalyzer/CallerParamMatcher.php | 6 ++-- .../NodeAnalyzer/NeverFuncCallAnalyzer.php | 2 +- .../VariableInSprintfMaskMatcher.php | 2 +- .../NodeManipulator/AddNeverReturnType.php | 2 +- .../PHPStan/ObjectTypeSpecifier.php | 2 +- .../ReturnTypeFromStrictTypedCallRector.php | 12 +++---- .../AddClosureParamTypeForArrayMapRector.php | 6 ++-- .../ParameterTypeFromDataProviderResolver.php | 2 +- .../TypeAnalyzer/ReturnStrictTypeAnalyzer.php | 6 ++-- .../TypeInferer/SilentVoidResolver.php | 2 +- .../ConstructorAssignedTypeResolver.php | 4 +-- .../TypeResolver/YieldTypeResolver.php | 2 +- .../PhpDocInfo/PhpDocInfo.php | 2 +- .../StaticDoctrineAnnotationParser.php | 4 +-- .../PlainValueParser.php | 6 ++-- .../ValueObject/Storage/FileCacheStorage.php | 2 +- src/Comments/CommentRemover.php | 2 +- src/Configuration/ConfigurationFactory.php | 2 +- src/Configuration/OnlyRuleResolver.php | 6 ++-- .../Reflection/FamilyRelationsAnalyzer.php | 2 +- src/NodeAnalyzer/PropertyPresenceChecker.php | 2 +- src/NodeAnalyzer/VariadicAnalyzer.php | 4 +-- .../ArrayCallableMethodMatcher.php | 4 +-- src/NodeDecorator/CreatedByRuleDecorator.php | 2 +- .../ClassInsertManipulator.php | 2 +- src/NodeManipulator/PropertyManipulator.php | 2 +- src/NodeNameResolver/NodeNameResolver.php | 6 ++-- src/NodeNestingScope/ContextAnalyzer.php | 2 +- .../NodeTypeResolver/NameTypeResolver.php | 2 +- .../Scope/PHPStanNodeScopeResolver.php | 5 ++- .../NameImportingPhpDocNodeVisitor.php | 2 +- .../PHPStanStaticTypeMapper.php | 2 +- .../SimpleCallableNodeTraverser.php | 4 +-- src/PhpParser/AstResolver.php | 12 +++---- src/PhpParser/Comparing/NodeComparator.php | 4 +-- src/PhpParser/Node/BetterNodeFinder.php | 22 ++++++------ src/PhpParser/Node/NodeFactory.php | 6 ++-- .../NodeFinder/PropertyFetchFinder.php | 6 ++-- ...osureWithVariadicParametersNodeVisitor.php | 2 +- .../Printer/BetterStandardPrinter.php | 2 +- src/Rector/AbstractRector.php | 4 +-- src/Reflection/ReflectionResolver.php | 6 ++-- src/Skipper/SkipVoter/ClassSkipVoter.php | 4 +-- src/Skipper/Skipper/SkipSkipper.php | 2 +- src/Skipper/Skipper/Skipper.php | 6 ++-- .../IdentifierPhpDocTypeMapper.php | 6 ++-- .../PhpParser/NameNodeMapper.php | 2 +- .../ValueObject/Type/AliasedObjectType.php | 2 +- .../Type/FullyQualifiedObjectType.php | 2 +- src/Util/FileHasher.php | 2 +- src/ValueObject/Configuration.php | 4 +-- .../ClassMethodReturnTypeOverrideGuard.php | 4 +-- src/functions/node_helper.php | 2 +- .../StaticDoctrineAnnotationParserTest.php | 2 +- .../config/configured_rule.php | 3 +- .../Node/Value/ValueResolverTest.php | 2 +- .../PhpDoc/PhpDocTypeMapperTest.php | 2 +- .../Util/Reflection/PrivatesAccessorTest.php | 2 +- 112 files changed, 224 insertions(+), 231 deletions(-) diff --git a/config/set/php72.php b/config/set/php72.php index 7857c06ce80..e9910521ad9 100644 --- a/config/set/php72.php +++ b/config/set/php72.php @@ -21,7 +21,7 @@ 'jpeg2wbmp' => 'imagecreatefromjpeg', # or imagewbmp 'png2wbmp' => 'imagecreatefrompng', - #migration72.deprecated.gmp_random-function + # migration72.deprecated.gmp_random-function # http://php.net/manual/en/migration72.deprecated.php # or gmp_random_range 'gmp_random' => 'gmp_random_bits', diff --git a/config/set/php74.php b/config/set/php74.php index 5094749e76f..5c4121de157 100644 --- a/config/set/php74.php +++ b/config/set/php74.php @@ -23,7 +23,7 @@ return static function (RectorConfig $rectorConfig): void { $rectorConfig ->ruleWithConfiguration(RenameFunctionRector::class, [ - #the_real_type + # the_real_type # https://wiki.php.net/rfc/deprecations_php_7_4 'is_real' => 'is_float', ]); diff --git a/rules-tests/Renaming/NodeAnalyzer/DeprecatedMethodCallReplacementResolverTest.php b/rules-tests/Renaming/NodeAnalyzer/DeprecatedMethodCallReplacementResolverTest.php index ca89b45031d..7bdcf4b55fa 100644 --- a/rules-tests/Renaming/NodeAnalyzer/DeprecatedMethodCallReplacementResolverTest.php +++ b/rules-tests/Renaming/NodeAnalyzer/DeprecatedMethodCallReplacementResolverTest.php @@ -36,7 +36,7 @@ public function test(string $methodName, ?string $expectedReplacement): void } /** - * @return Iterator + * @return Iterator */ public static function provideData(): Iterator { diff --git a/rules-tests/Renaming/Rector/Name/RenameClassRector/config/configured_rule.php b/rules-tests/Renaming/Rector/Name/RenameClassRector/config/configured_rule.php index 576f5c9f96e..1c6fd8f5977 100644 --- a/rules-tests/Renaming/Rector/Name/RenameClassRector/config/configured_rule.php +++ b/rules-tests/Renaming/Rector/Name/RenameClassRector/config/configured_rule.php @@ -25,8 +25,7 @@ ->ruleWithConfiguration(RenameClassRector::class, [ OldClass::class => NewClass::class, // interface to class - SomeBasicDateTime::class => - SomeBasicDateTimeInterface::class, + SomeBasicDateTime::class => SomeBasicDateTimeInterface::class, // test casing OldClassWithTypo::class => NewClassWithoutTypo::class, diff --git a/rules/Arguments/ArgumentDefaultValueReplacer.php b/rules/Arguments/ArgumentDefaultValueReplacer.php index 8df454fab78..d43128aa991 100644 --- a/rules/Arguments/ArgumentDefaultValueReplacer.php +++ b/rules/Arguments/ArgumentDefaultValueReplacer.php @@ -46,9 +46,9 @@ public function __construct( * @return TCall|null */ public function processReplaces( - MethodCall | StaticCall | ClassMethod | FuncCall | New_ $node, + MethodCall|StaticCall|ClassMethod|FuncCall|New_ $node, ReplaceArgumentDefaultValueInterface $replaceArgumentDefaultValue - ): MethodCall | StaticCall | ClassMethod | FuncCall | New_ |null { + ): MethodCall|StaticCall|ClassMethod|FuncCall|New_|null { if ($node instanceof ClassMethod) { if (! isset($node->params[$replaceArgumentDefaultValue->getPosition()])) { return null; @@ -103,7 +103,7 @@ private function processParams( * @return TCall|null */ private function processArgs( - MethodCall | StaticCall | FuncCall | New_ $expr, + MethodCall|StaticCall|FuncCall|New_ $expr, ReplaceArgumentDefaultValueInterface $replaceArgumentDefaultValue ): ?Expr { if ($expr->isFirstClassCallable()) { diff --git a/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php b/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php index a24edef7aa5..bd0bfc248a2 100644 --- a/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php +++ b/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php @@ -35,7 +35,7 @@ public function __construct( } public function isInCorrectScope( - MethodCall | StaticCall $expr, + MethodCall|StaticCall $expr, ArgumentAdder|ArgumentAdderWithoutDefaultValue $argumentAdder ): bool { if ($argumentAdder->getScope() === null) { diff --git a/rules/Arguments/Rector/ClassMethod/ArgumentAdderRector.php b/rules/Arguments/Rector/ClassMethod/ArgumentAdderRector.php index 1c18f35cf74..ab55342f28f 100644 --- a/rules/Arguments/Rector/ClassMethod/ArgumentAdderRector.php +++ b/rules/Arguments/Rector/ClassMethod/ArgumentAdderRector.php @@ -111,7 +111,7 @@ public function getNodeTypes(): array /** * @param MethodCall|StaticCall|Class_ $node */ - public function refactor(Node $node): MethodCall | StaticCall | Class_ | null + public function refactor(Node $node): MethodCall|StaticCall|Class_|null { $this->hasChanged = false; @@ -139,7 +139,7 @@ public function configure(array $configuration): void $this->addedArguments = $configuration; } - private function isObjectTypeMatch(MethodCall | StaticCall $call, ObjectType $objectType): bool + private function isObjectTypeMatch(MethodCall|StaticCall $call, ObjectType $objectType): bool { if ($call instanceof MethodCall) { return $this->isObjectType($call->var, $objectType); @@ -149,7 +149,7 @@ private function isObjectTypeMatch(MethodCall | StaticCall $call, ObjectType $ob } private function processPositionWithDefaultValues( - ClassMethod | MethodCall | StaticCall $node, + ClassMethod|MethodCall|StaticCall $node, ArgumentAdder|ArgumentAdderWithoutDefaultValue $argumentAdder ): void { if ($this->shouldSkipParameter($node, $argumentAdder)) { @@ -202,7 +202,7 @@ private function processMethodCall( $this->hasChanged = true; } - private function fillGapBetweenWithDefaultValue(MethodCall | StaticCall $node, int $position): void + private function fillGapBetweenWithDefaultValue(MethodCall|StaticCall $node, int $position): void { $lastPosition = count($node->getArgs()) - 1; if ($position <= $lastPosition) { @@ -229,7 +229,7 @@ private function fillGapBetweenWithDefaultValue(MethodCall | StaticCall $node, i } private function shouldSkipParameter( - ClassMethod | MethodCall | StaticCall $node, + ClassMethod|MethodCall|StaticCall $node, ArgumentAdder|ArgumentAdderWithoutDefaultValue $argumentAdder ): bool { $position = $argumentAdder->getPosition(); @@ -266,7 +266,7 @@ private function shouldSkipParameter( if ($firstNamedArgumentPosition !== null) { // Check if the parameter we're trying to add is before the first named argument if ($position < $firstNamedArgumentPosition) { - return true; //if that is the case, the parameter already exists, skip + return true; // if that is the case, the parameter already exists, skip } // Check if the parameter we're trying to add is already present as a named argument diff --git a/rules/Arguments/Rector/ClassMethod/ReplaceArgumentDefaultValueRector.php b/rules/Arguments/Rector/ClassMethod/ReplaceArgumentDefaultValueRector.php index 89f841e8c26..2159a2a5826 100644 --- a/rules/Arguments/Rector/ClassMethod/ReplaceArgumentDefaultValueRector.php +++ b/rules/Arguments/Rector/ClassMethod/ReplaceArgumentDefaultValueRector.php @@ -75,7 +75,7 @@ public function getNodeTypes(): array /** * @param MethodCall|StaticCall|ClassMethod|New_ $node */ - public function refactor(Node $node): MethodCall | StaticCall | ClassMethod | New_ | null + public function refactor(Node $node): MethodCall|StaticCall|ClassMethod|New_|null { if ($node instanceof New_) { return $this->refactorNew($node); diff --git a/rules/Arguments/ValueObject/ArgumentAdder.php b/rules/Arguments/ValueObject/ArgumentAdder.php index bd15a59b6dc..4b2cad396dd 100644 --- a/rules/Arguments/ValueObject/ArgumentAdder.php +++ b/rules/Arguments/ValueObject/ArgumentAdder.php @@ -19,7 +19,7 @@ public function __construct( private readonly int $position, private readonly ?string $argumentName = null, private $argumentDefaultValue = null, - private readonly Type | null $argumentType = null, + private readonly Type|null $argumentType = null, private readonly ?string $scope = null ) { RectorAssert::className($class); diff --git a/rules/Arguments/ValueObject/ArgumentAdderWithoutDefaultValue.php b/rules/Arguments/ValueObject/ArgumentAdderWithoutDefaultValue.php index 4140b950621..4c4d0a7c29e 100644 --- a/rules/Arguments/ValueObject/ArgumentAdderWithoutDefaultValue.php +++ b/rules/Arguments/ValueObject/ArgumentAdderWithoutDefaultValue.php @@ -15,7 +15,7 @@ public function __construct( private string $method, private int $position, private ?string $argumentName = null, - private Type | null $argumentType = null, + private Type|null $argumentType = null, private ?string $scope = null ) { RectorAssert::className($class); diff --git a/rules/CodeQuality/NodeManipulator/NamedArgsSorter.php b/rules/CodeQuality/NodeManipulator/NamedArgsSorter.php index 22821486aaf..47edbba3533 100644 --- a/rules/CodeQuality/NodeManipulator/NamedArgsSorter.php +++ b/rules/CodeQuality/NodeManipulator/NamedArgsSorter.php @@ -18,7 +18,7 @@ final class NamedArgsSorter */ public function sortArgsToMatchReflectionParameters( array $currentArgs, - FunctionReflection | MethodReflection $functionLikeReflection, + FunctionReflection|MethodReflection $functionLikeReflection, ): array { $extendedParametersAcceptor = ParametersAcceptorSelector::combineAcceptors( $functionLikeReflection->getVariants() diff --git a/rules/CodeQuality/Rector/Class_/ConvertStaticToSelfRector.php b/rules/CodeQuality/Rector/Class_/ConvertStaticToSelfRector.php index 7690d6f8db6..8c9e2ccbd27 100644 --- a/rules/CodeQuality/Rector/Class_/ConvertStaticToSelfRector.php +++ b/rules/CodeQuality/Rector/Class_/ConvertStaticToSelfRector.php @@ -111,7 +111,7 @@ public function refactor(Node $node): ?Class_ } private function shouldSkip( - StaticPropertyFetch | StaticCall | ClassConstFetch $node, + StaticPropertyFetch|StaticCall|ClassConstFetch $node, ClassReflection $classReflection, bool $isFinal, Scope $scope, diff --git a/rules/CodeQuality/Rector/Foreach_/ForeachToInArrayRector.php b/rules/CodeQuality/Rector/Foreach_/ForeachToInArrayRector.php index 8e7571d7ac3..05721d1b1d5 100644 --- a/rules/CodeQuality/Rector/Foreach_/ForeachToInArrayRector.php +++ b/rules/CodeQuality/Rector/Foreach_/ForeachToInArrayRector.php @@ -208,7 +208,7 @@ private function isIfBodyABoolReturnNode(If_ $if): bool return $this->valueResolver->isTrueOrFalse($ifStatement->expr); } - private function createInArrayFunction(Expr $expr, Identical | Equal $binaryOp, Foreach_ $foreach): FuncCall + private function createInArrayFunction(Expr $expr, Identical|Equal $binaryOp, Foreach_ $foreach): FuncCall { $arguments = $this->nodeFactory->createArgs([$expr, $foreach->expr]); diff --git a/rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php b/rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php index 3cbeaeb7c05..a8fd32247a9 100644 --- a/rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php +++ b/rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php @@ -167,7 +167,7 @@ private function resolveNewConditionNode(Expr $expr, bool $isNegated): BinaryOp| return null; } - private function resolveCount(bool $isNegated, FuncCall $funcCall): Identical | Greater | null + private function resolveCount(bool $isNegated, FuncCall $funcCall): Identical|Greater|null { if ($funcCall->isFirstClassCallable()) { return null; @@ -208,7 +208,7 @@ private function resolveArray(bool $isNegated, Expr $expr): ?BinaryOp return new NotIdentical($expr, $array); } - private function resolveString(bool $isNegated, Expr $expr): Identical | NotIdentical | BooleanAnd | BooleanOr + private function resolveString(bool $isNegated, Expr $expr): Identical|NotIdentical|BooleanAnd|BooleanOr { $emptyString = new String_(''); @@ -231,7 +231,7 @@ private function resolveString(bool $isNegated, Expr $expr): Identical | NotIden return $identical; } - private function resolveIdentical(Expr $expr, bool $isNegated, String_ $string): Identical | NotIdentical + private function resolveIdentical(Expr $expr, bool $isNegated, String_ $string): Identical|NotIdentical { /** * // compare === '' @@ -244,17 +244,17 @@ private function resolveIdentical(Expr $expr, bool $isNegated, String_ $string): } private function resolveZeroIdenticalString( - Identical | NotIdentical $identical, + Identical|NotIdentical $identical, bool $isNegated, Expr $expr - ): BooleanAnd | BooleanOr { + ): BooleanAnd|BooleanOr { $string = new String_('0'); $zeroIdentical = $isNegated ? new Identical($expr, $string) : new NotIdentical($expr, $string); return $isNegated ? new BooleanOr($identical, $zeroIdentical) : new BooleanAnd($identical, $zeroIdentical); } - private function resolveInteger(bool $isNegated, Expr $expr): Identical | NotIdentical + private function resolveInteger(bool $isNegated, Expr $expr): Identical|NotIdentical { $int = new Int_(0); @@ -265,7 +265,7 @@ private function resolveInteger(bool $isNegated, Expr $expr): Identical | NotIde return new NotIdentical($expr, $int); } - private function resolveFloat(bool $isNegated, Expr $expr): Identical | NotIdentical + private function resolveFloat(bool $isNegated, Expr $expr): Identical|NotIdentical { $float = new Float_(0.0); @@ -280,7 +280,7 @@ private function resolveNullable( bool $isNegated, Expr $expr, ObjectType $objectType - ): BooleanNot | Instanceof_ { + ): BooleanNot|Instanceof_ { $fullyQualified = new FullyQualified($objectType->getClassName()); $instanceof = new Instanceof_($expr, $fullyQualified); diff --git a/rules/CodingStyle/Naming/ClassNaming.php b/rules/CodingStyle/Naming/ClassNaming.php index 2a90030b3fc..fc7b2c042c1 100644 --- a/rules/CodingStyle/Naming/ClassNaming.php +++ b/rules/CodingStyle/Naming/ClassNaming.php @@ -11,7 +11,7 @@ final class ClassNaming { - public function getShortName(string | Name | Identifier | ClassLike $name): string + public function getShortName(string|Name|Identifier|ClassLike $name): string { if ($name instanceof ClassLike) { if (! $name->name instanceof Identifier) { diff --git a/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php b/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php index d470bfb0fa9..7109c562152 100644 --- a/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php @@ -110,9 +110,9 @@ public function provideMinPhpVersion(): int } private function applyVariadicParams( - ClassMethod | Function_ | Closure $node, + ClassMethod|Function_|Closure $node, string $variableName - ): ClassMethod | Function_ | Closure | null { + ): ClassMethod|Function_|Closure|null { $param = $this->createVariadicParam($variableName); if ($param->var instanceof Variable && $this->hasFunctionOrClosureInside($node, $param->var)) { @@ -124,7 +124,7 @@ private function applyVariadicParams( } private function hasFunctionOrClosureInside( - ClassMethod | Function_ | Closure $functionLike, + ClassMethod|Function_|Closure $functionLike, Variable $variable ): bool { if ($functionLike->stmts === null) { @@ -156,7 +156,7 @@ private function hasFunctionOrClosureInside( /** * @return Expression|null */ - private function matchFuncGetArgsVariableAssign(ClassMethod | Function_ | Closure $functionLike): ?Expression + private function matchFuncGetArgsVariableAssign(ClassMethod|Function_|Closure $functionLike): ?Expression { /** @var Expression[] $expressions */ $expressions = $this->betterNodeFinder->findInstancesOfInFunctionLikeScoped($functionLike, Expression::class); diff --git a/rules/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php b/rules/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php index 186d791fce4..02fa6f23b6f 100644 --- a/rules/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php @@ -159,7 +159,7 @@ private function resolveCurrentStmtVariableName(Stmt $stmt): ?string private function shouldAddEmptyLine( ?string $currentStmtVariableName, - ClassMethod | Function_ | Closure $node, + ClassMethod|Function_|Closure $node, int $key ): bool { if (! $this->isNewVariableThanBefore($currentStmtVariableName)) { @@ -170,7 +170,7 @@ private function shouldAddEmptyLine( return ! $this->isPrecededByEmptyLine($node, $key); } - private function shouldSkipLeftVariable(Assign | MethodCall $node): bool + private function shouldSkipLeftVariable(Assign|MethodCall $node): bool { if (! $node->var instanceof Variable) { return false; @@ -201,7 +201,7 @@ private function isNewVariableThanBefore(?string $currentStmtVariableName): bool return $this->previousStmtVariableName !== $currentStmtVariableName; } - private function isPrecededByEmptyLine(ClassMethod | Function_ | Closure $node, int $key): bool + private function isPrecededByEmptyLine(ClassMethod|Function_|Closure $node, int $key): bool { if ($node->stmts === null) { return false; diff --git a/rules/CodingStyle/Rector/FuncCall/CountArrayToEmptyArrayComparisonRector.php b/rules/CodingStyle/Rector/FuncCall/CountArrayToEmptyArrayComparisonRector.php index 29f3e1a5b37..ae5b820707a 100644 --- a/rules/CodingStyle/Rector/FuncCall/CountArrayToEmptyArrayComparisonRector.php +++ b/rules/CodingStyle/Rector/FuncCall/CountArrayToEmptyArrayComparisonRector.php @@ -143,7 +143,7 @@ private function refactorIdenticalOrNotIdentical( return null; } - private function refactorGreaterOrSmaller(Greater | Smaller $binaryOp): NotIdentical | null + private function refactorGreaterOrSmaller(Greater|Smaller $binaryOp): NotIdentical|null { if ($binaryOp instanceof Greater) { $leftExpr = $this->matchCountFuncCallArgExpr($binaryOp->left); @@ -170,7 +170,7 @@ private function refactorGreaterOrSmaller(Greater | Smaller $binaryOp): NotIdent return new NotIdentical(new Array_([]), $rightExpr); } - private function refactorIfElseIf(If_ | ElseIf_ $ifElseIf): If_ | ElseIf_ | null + private function refactorIfElseIf(If_|ElseIf_ $ifElseIf): If_|ElseIf_|null { $expr = $this->matchCountFuncCallArgExpr($ifElseIf->cond); if (! $expr instanceof Expr) { diff --git a/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php b/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php index 4e2afeff160..2bb2a54b410 100644 --- a/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php +++ b/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php @@ -135,7 +135,7 @@ private function isPhpVersionConstant(Expr $expr): bool return $expr->name->toString() === 'PHP_VERSION'; } - private function getNewNodeForArg(Expr $expr): ConstFetch | Int_ | null + private function getNewNodeForArg(Expr $expr): ConstFetch|Int_|null { if ($this->isPhpVersionConstant($expr)) { return new ConstFetch(new Name('PHP_VERSION_ID')); diff --git a/rules/CodingStyle/Rector/PostInc/PostIncDecToPreIncDecRector.php b/rules/CodingStyle/Rector/PostInc/PostIncDecToPreIncDecRector.php index 2d1bffd8546..2e5cda5502a 100644 --- a/rules/CodingStyle/Rector/PostInc/PostIncDecToPreIncDecRector.php +++ b/rules/CodingStyle/Rector/PostInc/PostIncDecToPreIncDecRector.php @@ -88,7 +88,7 @@ private function refactorFor(For_ $for): For_|null return $for; } - private function processPrePost(PostInc | PostDec $node): PreInc | PreDec + private function processPrePost(PostInc|PostDec $node): PreInc|PreDec { if ($node instanceof PostInc) { return new PreInc($node->var); diff --git a/rules/DeadCode/ConditionEvaluator.php b/rules/DeadCode/ConditionEvaluator.php index 49366651d3b..10defdeb1cc 100644 --- a/rules/DeadCode/ConditionEvaluator.php +++ b/rules/DeadCode/ConditionEvaluator.php @@ -36,7 +36,7 @@ public function evaluate(ConditionInterface $condition): bool|int|null private function evaluateVersionCompareCondition( VersionCompareCondition $versionCompareCondition - ): bool | int | null { + ): bool|int|null { $compareSign = $versionCompareCondition->getCompareSign(); if ($compareSign !== null) { if ($compareSign === '<' && $this->phpVersionProvider->provide() < $versionCompareCondition->getSecondVersion()) { diff --git a/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php b/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php index 3af10f7cd9e..e65e953189f 100644 --- a/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php +++ b/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php @@ -148,7 +148,7 @@ private function isClassMethodCalledInLocalArrayCall(Class_ $class, ClassMethod return false; } - private function shouldSkipArrayCallable(Class_ $class, null | ArrayCallable $arrayCallable): bool + private function shouldSkipArrayCallable(Class_ $class, null|ArrayCallable $arrayCallable): bool { if (! $arrayCallable instanceof ArrayCallable) { return true; @@ -183,7 +183,6 @@ private function isUsedByTrait(Trait_ $trait, string $classMethodName, string $c /** * Trait can't detect class type, so it rely on "this" or "self" or "static" or "ClassName::methodName()" usage... */ - $callMethod = null; $this->simpleCallableNodeTraverser->traverseNodesWithCallable( (array) $classMethod->stmts, diff --git a/rules/DeadCode/NodeManipulator/LivingCodeManipulator.php b/rules/DeadCode/NodeManipulator/LivingCodeManipulator.php index 1b24ab7638f..a5254239ff5 100644 --- a/rules/DeadCode/NodeManipulator/LivingCodeManipulator.php +++ b/rules/DeadCode/NodeManipulator/LivingCodeManipulator.php @@ -46,7 +46,7 @@ public function __construct( /** * @return Expr[]|mixed[] */ - public function keepLivingCodeFromExpr(Node | int | string | null $expr): array + public function keepLivingCodeFromExpr(Node|int|string|null $expr): array { if (! $expr instanceof Expr) { return []; diff --git a/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php b/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php index f8e7be2e4d7..35c2430c88b 100644 --- a/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php +++ b/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php @@ -72,7 +72,7 @@ public function removeVarTag(Node $node): bool return true; } - public function removeVarPhpTagValueNodeIfNotComment(Expression | Property | Param $node, Type $type): void + public function removeVarPhpTagValueNodeIfNotComment(Expression|Property|Param $node, Type $type): void { if ($type instanceof TemplateObjectWithoutClassType) { return; diff --git a/rules/DeadCode/Rector/ConstFetch/RemovePhpVersionIdCheckRector.php b/rules/DeadCode/Rector/ConstFetch/RemovePhpVersionIdCheckRector.php index 15528b4a3ba..f6cb9f44dbe 100644 --- a/rules/DeadCode/Rector/ConstFetch/RemovePhpVersionIdCheckRector.php +++ b/rules/DeadCode/Rector/ConstFetch/RemovePhpVersionIdCheckRector.php @@ -28,7 +28,7 @@ final class RemovePhpVersionIdCheckRector extends AbstractRector /** * @var PhpVersion::*|null */ - private int | null $phpVersion = null; + private int|null $phpVersion = null; public function __construct( private readonly PhpVersionProvider $phpVersionProvider, diff --git a/rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php b/rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php index f68584a58da..d48918c6b11 100644 --- a/rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php +++ b/rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php @@ -146,7 +146,7 @@ private function areNumberType(BinaryOp $binaryOp): bool return $this->nodeTypeResolver->isNumberType($binaryOp->right); } - private function processBinaryPlusAndMinus(Plus | Minus $binaryOp): ?Expr + private function processBinaryPlusAndMinus(Plus|Minus $binaryOp): ?Expr { if (! $this->areNumberType($binaryOp)) { return null; @@ -201,7 +201,7 @@ private function isMulParenthesized(File $file, Mul $mul): bool return false; } - private function processBinaryMulAndDiv(Mul | Div $binaryOp): ?Expr + private function processBinaryMulAndDiv(Mul|Div $binaryOp): ?Expr { if ($binaryOp->left instanceof ClassConstFetch || $binaryOp->right instanceof ClassConstFetch) { return null; diff --git a/rules/DeadCode/UselessIfCondBeforeForeachDetector.php b/rules/DeadCode/UselessIfCondBeforeForeachDetector.php index 71402a15f4e..dff774687bf 100644 --- a/rules/DeadCode/UselessIfCondBeforeForeachDetector.php +++ b/rules/DeadCode/UselessIfCondBeforeForeachDetector.php @@ -88,7 +88,7 @@ public function isMatchingNotIdenticalEmptyArray(If_ $if, Expr $foreachExpr): bo return $this->isMatchingNotBinaryOp($notIdentical, $foreachExpr); } - private function isMatchingNotBinaryOp(NotIdentical | NotEqual $binaryOp, Expr $foreachExpr): bool + private function isMatchingNotBinaryOp(NotIdentical|NotEqual $binaryOp, Expr $foreachExpr): bool { if ($this->isEmptyArrayAndForeachedVariable($binaryOp->left, $binaryOp->right, $foreachExpr)) { return true; diff --git a/rules/EarlyReturn/Rector/If_/RemoveAlwaysElseRector.php b/rules/EarlyReturn/Rector/If_/RemoveAlwaysElseRector.php index fe1de1acf25..4e79993f904 100644 --- a/rules/EarlyReturn/Rector/If_/RemoveAlwaysElseRector.php +++ b/rules/EarlyReturn/Rector/If_/RemoveAlwaysElseRector.php @@ -165,7 +165,7 @@ private function getStatementsElseIfs(If_ $if): array return $statements; } - private function doesNotLastStatementBreakFlow(If_ | ElseIf_ | Else_ $node): bool + private function doesNotLastStatementBreakFlow(If_|ElseIf_|Else_ $node): bool { $lastStmt = end($node->stmts); @@ -188,7 +188,7 @@ private function doesNotLastStatementBreakFlow(If_ | ElseIf_ | Else_ $node): boo || ($lastStmt instanceof Expression && $lastStmt->expr instanceof Exit_)); } - private function createIfFromNode(If_ | ElseIf_ $node): If_ + private function createIfFromNode(If_|ElseIf_ $node): If_ { $if = new If_($node->cond); $if->stmts = $node->stmts; diff --git a/rules/Naming/Guard/BreakingVariableRenameGuard.php b/rules/Naming/Guard/BreakingVariableRenameGuard.php index a266c9f3975..4ce1287046a 100644 --- a/rules/Naming/Guard/BreakingVariableRenameGuard.php +++ b/rules/Naming/Guard/BreakingVariableRenameGuard.php @@ -48,7 +48,7 @@ public function __construct( public function shouldSkipVariable( string $currentName, string $expectedName, - ClassMethod | Function_ | Closure | ArrowFunction $functionLike, + ClassMethod|Function_|Closure|ArrowFunction $functionLike, Variable $variable ): bool { // is the suffix? → also accepted @@ -151,7 +151,7 @@ private function isVariableAlreadyDefined(Variable $variable, string $currentVar } private function hasConflictVariable( - ClassMethod | Function_ | Closure | ArrowFunction $functionLike, + ClassMethod|Function_|Closure|ArrowFunction $functionLike, string $newName ): bool { if ($functionLike instanceof ArrowFunction) { @@ -171,7 +171,7 @@ private function hasConflictVariable( private function isUsedInClosureUsesName( string $expectedName, - ClassMethod | Function_ | Closure $functionLike + ClassMethod|Function_|Closure $functionLike ): bool { if (! $functionLike instanceof Closure) { return false; diff --git a/rules/Naming/Matcher/CallMatcher.php b/rules/Naming/Matcher/CallMatcher.php index 4e0a5894f5e..657ac49180d 100644 --- a/rules/Naming/Matcher/CallMatcher.php +++ b/rules/Naming/Matcher/CallMatcher.php @@ -16,7 +16,7 @@ final class CallMatcher /** * @return FuncCall|StaticCall|MethodCall|null */ - public function matchCall(Assign | Foreach_ $node): ?Node + public function matchCall(Assign|Foreach_ $node): ?Node { if ($node->expr instanceof MethodCall) { return $node->expr; diff --git a/rules/Naming/Matcher/VariableAndCallAssignMatcher.php b/rules/Naming/Matcher/VariableAndCallAssignMatcher.php index 71f6e5a0092..fe2bb23901e 100644 --- a/rules/Naming/Matcher/VariableAndCallAssignMatcher.php +++ b/rules/Naming/Matcher/VariableAndCallAssignMatcher.php @@ -41,8 +41,7 @@ public function match(Assign $assign, ClassMethod|Closure|Function_ $functionLik $isVariableFoundInCallArgs = (bool) $this->betterNodeFinder->findFirst( $call->isFirstClassCallable() ? [] : $call->getArgs(), - fn (Node $subNode): bool => - $subNode instanceof Variable && $this->nodeNameResolver->isName($subNode, $variableName) + fn (Node $subNode): bool => $subNode instanceof Variable && $this->nodeNameResolver->isName($subNode, $variableName) ); if ($isVariableFoundInCallArgs) { diff --git a/rules/Naming/Naming/ConflictingNameResolver.php b/rules/Naming/Naming/ConflictingNameResolver.php index 136294896e5..f0e4b802d02 100644 --- a/rules/Naming/Naming/ConflictingNameResolver.php +++ b/rules/Naming/Naming/ConflictingNameResolver.php @@ -51,7 +51,7 @@ public function resolveConflictingVariableNamesForParam( public function hasNameIsInFunctionLike( string $variableName, - ClassMethod | Function_ | Closure | ArrowFunction $functionLike + ClassMethod|Function_|Closure|ArrowFunction $functionLike ): bool { $conflictingVariableNames = $this->resolveConflictingVariableNamesForNew($functionLike); return in_array($variableName, $conflictingVariableNames, true); @@ -61,7 +61,7 @@ public function hasNameIsInFunctionLike( * @return string[] */ private function resolveConflictingVariableNamesForNew( - ClassMethod | Function_ | Closure | ArrowFunction $functionLike + ClassMethod|Function_|Closure|ArrowFunction $functionLike ): array { // cache it! $classMethodId = spl_object_id($functionLike); @@ -85,7 +85,7 @@ private function resolveConflictingVariableNamesForNew( /** * @return string[] */ - private function resolveForNewAssigns(ClassMethod | Function_ | Closure | ArrowFunction $functionLike): array + private function resolveForNewAssigns(ClassMethod|Function_|Closure|ArrowFunction $functionLike): array { $names = []; @@ -106,7 +106,7 @@ private function resolveForNewAssigns(ClassMethod | Function_ | Closure | ArrowF /** * @return string[] */ - private function resolveForNonNewAssigns(ClassMethod | Function_ | Closure | ArrowFunction $functionLike): array + private function resolveForNonNewAssigns(ClassMethod|Function_|Closure|ArrowFunction $functionLike): array { $names = []; diff --git a/rules/Naming/Naming/ExpectedNameResolver.php b/rules/Naming/Naming/ExpectedNameResolver.php index 11112c5c54e..ab511873208 100644 --- a/rules/Naming/Naming/ExpectedNameResolver.php +++ b/rules/Naming/Naming/ExpectedNameResolver.php @@ -98,7 +98,7 @@ public function resolveForAssignNew(Assign $assign): ?string return $expectedName->getName(); } - public function resolveForCall(MethodCall | StaticCall | FuncCall $expr): ?string + public function resolveForCall(MethodCall|StaticCall|FuncCall $expr): ?string { if ($this->isDynamicNameCall($expr)) { return null; @@ -183,7 +183,7 @@ private function isReturnedTypeAnArrayAndExpectedNameFromTypeNotNull( return ($returnedType instanceof ArrayType) && $expectedName instanceof ExpectedName; } - private function isDynamicNameCall(MethodCall | StaticCall | FuncCall $expr): bool + private function isDynamicNameCall(MethodCall|StaticCall|FuncCall $expr): bool { if ($expr->name instanceof StaticCall) { return true; diff --git a/rules/Naming/Naming/OverriddenExistingNamesResolver.php b/rules/Naming/Naming/OverriddenExistingNamesResolver.php index f890b14c07d..094d33eaf1d 100644 --- a/rules/Naming/Naming/OverriddenExistingNamesResolver.php +++ b/rules/Naming/Naming/OverriddenExistingNamesResolver.php @@ -30,7 +30,7 @@ public function __construct( public function hasNameInClassMethodForNew( string $variableName, - ClassMethod | Function_ | Closure $functionLike + ClassMethod|Function_|Closure $functionLike ): bool { $overriddenVariableNames = $this->resolveOverriddenNamesForNew($functionLike); return in_array($variableName, $overriddenVariableNames, true); @@ -63,7 +63,7 @@ public function hasNameInFunctionLikeForParam( /** * @return string[] */ - private function resolveOverriddenNamesForNew(ClassMethod | Function_ | Closure $functionLike): array + private function resolveOverriddenNamesForNew(ClassMethod|Function_|Closure $functionLike): array { $classMethodId = spl_object_id($functionLike); diff --git a/rules/Naming/Naming/PropertyNaming.php b/rules/Naming/Naming/PropertyNaming.php index 27a72688f91..4851f4f9091 100644 --- a/rules/Naming/Naming/PropertyNaming.php +++ b/rules/Naming/Naming/PropertyNaming.php @@ -112,7 +112,7 @@ public function getExpectedNameFromType(Type $type): ?ExpectedName return new ExpectedName($originalName, $this->rectorNamingInflector->singularize($originalName)); } - public function fqnToVariableName(ThisType | ObjectType | Name | string $objectType): string + public function fqnToVariableName(ThisType|ObjectType|Name|string $objectType): string { if ($objectType instanceof Name) { $objectType = $objectType->toString(); @@ -194,7 +194,7 @@ private function prolongIfTooShort(string $shortClassName, string $className): s return lcfirst($shortClassName); } - private function resolveClassName(ObjectType | string $objectType): string + private function resolveClassName(ObjectType|string $objectType): string { if ($objectType instanceof ObjectType) { return $objectType->getClassName(); diff --git a/rules/Naming/NamingConvention/NamingConventionAnalyzer.php b/rules/Naming/NamingConvention/NamingConventionAnalyzer.php index 5edafa72ef0..98ce919eb52 100644 --- a/rules/Naming/NamingConvention/NamingConventionAnalyzer.php +++ b/rules/Naming/NamingConvention/NamingConventionAnalyzer.php @@ -25,7 +25,7 @@ public function __construct( * $someName = $this->getSomeName(); */ public function isCallMatchingVariableName( - FuncCall | StaticCall | MethodCall $expr, + FuncCall|StaticCall|MethodCall $expr, string $currentName, string $expectedName ): bool { diff --git a/rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php b/rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php index 42577400960..bdab16b0135 100644 --- a/rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php +++ b/rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php @@ -146,8 +146,7 @@ private function shouldSkipClassMethodFromVendor(ClassMethod $classMethod): bool $ancestorClassReflections = array_filter( $classReflection->getAncestors(), - fn (ClassReflection $ancestorClassReflection): bool => - $classReflection->getName() !== $ancestorClassReflection->getName() + fn (ClassReflection $ancestorClassReflection): bool => $classReflection->getName() !== $ancestorClassReflection->getName() ); $methodName = $this->getName($classMethod); diff --git a/rules/Naming/ValueObject/VariableAndCallAssign.php b/rules/Naming/ValueObject/VariableAndCallAssign.php index 7de03fd5b24..b1cf44833c0 100644 --- a/rules/Naming/ValueObject/VariableAndCallAssign.php +++ b/rules/Naming/ValueObject/VariableAndCallAssign.php @@ -17,10 +17,10 @@ { public function __construct( private Variable $variable, - private FuncCall | StaticCall | MethodCall $expr, + private FuncCall|StaticCall|MethodCall $expr, private Assign $assign, private string $variableName, - private ClassMethod | Function_ | Closure $functionLike + private ClassMethod|Function_|Closure $functionLike ) { } @@ -29,7 +29,7 @@ public function getVariable(): Variable return $this->variable; } - public function getCall(): FuncCall | MethodCall | StaticCall + public function getCall(): FuncCall|MethodCall|StaticCall { return $this->expr; } @@ -39,7 +39,7 @@ public function getVariableName(): string return $this->variableName; } - public function getFunctionLike(): Closure | ClassMethod | Function_ + public function getFunctionLike(): Closure|ClassMethod|Function_ { return $this->functionLike; } diff --git a/rules/Naming/ValueObject/VariableAndCallForeach.php b/rules/Naming/ValueObject/VariableAndCallForeach.php index 8628a964c8c..80cf6bda6d3 100644 --- a/rules/Naming/ValueObject/VariableAndCallForeach.php +++ b/rules/Naming/ValueObject/VariableAndCallForeach.php @@ -16,9 +16,9 @@ { public function __construct( private Variable $variable, - private FuncCall | StaticCall | MethodCall $expr, + private FuncCall|StaticCall|MethodCall $expr, private string $variableName, - private ClassMethod | Function_ | Closure $functionLike + private ClassMethod|Function_|Closure $functionLike ) { } @@ -27,7 +27,7 @@ public function getVariable(): Variable return $this->variable; } - public function getCall(): FuncCall | MethodCall | StaticCall + public function getCall(): FuncCall|MethodCall|StaticCall { return $this->expr; } @@ -37,7 +37,7 @@ public function getVariableName(): string return $this->variableName; } - public function getFunctionLike(): Closure | ClassMethod | Function_ + public function getFunctionLike(): Closure|ClassMethod|Function_ { return $this->functionLike; } diff --git a/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php b/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php index 97a831172c3..a00b9d9f41a 100644 --- a/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php +++ b/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php @@ -151,7 +151,7 @@ function (Node $subNode): null|int|Break_ { ); } - private function processVariableNum(Continue_ $continue, Variable $numVariable): Continue_ | Break_ + private function processVariableNum(Continue_ $continue, Variable $numVariable): Continue_|Break_ { $staticType = $this->getType($numVariable); if (! $staticType->isConstantValue()->yes()) { diff --git a/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php b/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php index 4b44538da1a..56b44b93cb4 100644 --- a/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php +++ b/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php @@ -110,7 +110,7 @@ public function refactor(Node $node): ?Node return null; } - private function processVariableNum(Break_ | Continue_ $stmt, Variable $numVariable): ?Node + private function processVariableNum(Break_|Continue_ $stmt, Variable $numVariable): ?Node { $staticType = $this->getType($numVariable); diff --git a/rules/Php70/EregToPcreTransformer.php b/rules/Php70/EregToPcreTransformer.php index eb41dc56ee2..5f71e4e6cf9 100644 --- a/rules/Php70/EregToPcreTransformer.php +++ b/rules/Php70/EregToPcreTransformer.php @@ -244,7 +244,8 @@ private function processSquareBracket(string $s, int $i, int $l, string $cls, bo if ($b === ']') { $cls .= $this->_ere2pcre_escape($a) . '\-'; break; - } elseif (ord($a) > ord($b)) { + } + if (ord($a) > ord($b)) { $errorMessage = sprintf('an invalid character range %d-%d"', (int) $a, (int) $b); throw new InvalidEregException($errorMessage); } diff --git a/rules/Php71/Rector/FuncCall/RemoveExtraParametersRector.php b/rules/Php71/Rector/FuncCall/RemoveExtraParametersRector.php index dd17169e1f5..14a28767212 100644 --- a/rules/Php71/Rector/FuncCall/RemoveExtraParametersRector.php +++ b/rules/Php71/Rector/FuncCall/RemoveExtraParametersRector.php @@ -124,7 +124,7 @@ private function shouldSkipFunctionReflection(MethodReflection|FunctionReflectio return false; } - private function shouldSkip(FuncCall | MethodCall | StaticCall $call): bool + private function shouldSkip(FuncCall|MethodCall|StaticCall $call): bool { if ($call->args === []) { return true; @@ -144,7 +144,7 @@ private function shouldSkip(FuncCall | MethodCall | StaticCall $call): bool } private function resolveMaximumAllowedParameterCount( - MethodReflection | FunctionReflection $functionLikeReflection + MethodReflection|FunctionReflection $functionLikeReflection ): int { $parameterCounts = [0]; foreach ($functionLikeReflection->getVariants() as $parametersAcceptor) { diff --git a/rules/Php72/NodeFactory/AnonymousFunctionFactory.php b/rules/Php72/NodeFactory/AnonymousFunctionFactory.php index be6c9ba511b..d84f9305b2c 100644 --- a/rules/Php72/NodeFactory/AnonymousFunctionFactory.php +++ b/rules/Php72/NodeFactory/AnonymousFunctionFactory.php @@ -55,7 +55,7 @@ public function __construct( public function create( array $params, array $stmts, - Identifier | Name | NullableType | UnionType | ComplexType | null $returnTypeNode, + Identifier|Name|NullableType|UnionType|ComplexType|null $returnTypeNode, bool $static = false ): Closure { $useVariables = $this->createUseVariablesFromParams($stmts, $params); diff --git a/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php b/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php index 938d8633698..5119eee4b06 100644 --- a/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php +++ b/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php @@ -129,7 +129,7 @@ private function createNewStmts(Expr $assignVariable, Expr $eachedVariable): arr private function createDimFetchAssignWithFuncCall( Expr $assignVariable, Expr $eachedVariable, - string | int $dimValue, + string|int $dimValue, string $functionName ): Assign { $dimExpr = BuilderHelpers::normalizeValue($dimValue); diff --git a/rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php b/rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php index 6376539f8fa..82faf2cb157 100644 --- a/rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php +++ b/rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php @@ -25,7 +25,7 @@ public function __construct( } public function hasPhpAttribute( - Property | ClassLike | ClassMethod | Function_ | Param $node, + Property|ClassLike|ClassMethod|Function_|Param $node, string $attributeClass ): bool { foreach ($node->attrGroups as $attrGroup) { @@ -45,7 +45,7 @@ public function hasPhpAttribute( * @param string[] $attributeClasses */ public function hasPhpAttributes( - Property | ClassLike | ClassMethod | Function_ | Param $node, + Property|ClassLike|ClassMethod|Function_|Param $node, array $attributeClasses ): bool { return array_any( diff --git a/rules/Php80/NodeFactory/StrStartsWithFuncCallFactory.php b/rules/Php80/NodeFactory/StrStartsWithFuncCallFactory.php index d10415032c8..ab16c3d2181 100644 --- a/rules/Php80/NodeFactory/StrStartsWithFuncCallFactory.php +++ b/rules/Php80/NodeFactory/StrStartsWithFuncCallFactory.php @@ -12,7 +12,7 @@ final class StrStartsWithFuncCallFactory { - public function createStrStartsWith(StrStartsWith $strStartsWith): FuncCall | BooleanNot + public function createStrStartsWith(StrStartsWith $strStartsWith): FuncCall|BooleanNot { $args = [new Arg($strStartsWith->getHaystackExpr()), new Arg($strStartsWith->getNeedleExpr())]; diff --git a/rules/Php80/NodeResolver/StrFalseComparisonResolver.php b/rules/Php80/NodeResolver/StrFalseComparisonResolver.php index 4bd30579aed..33e3c6d91a0 100644 --- a/rules/Php80/NodeResolver/StrFalseComparisonResolver.php +++ b/rules/Php80/NodeResolver/StrFalseComparisonResolver.php @@ -23,7 +23,7 @@ public function __construct( /** * @param string[] $oldStrFuncNames */ - public function resolve(Identical | NotIdentical | Equal | NotEqual $expr, array $oldStrFuncNames): ?FuncCall + public function resolve(Identical|NotIdentical|Equal|NotEqual $expr, array $oldStrFuncNames): ?FuncCall { if ($this->valueResolver->isFalse($expr->left)) { if (! $expr->right instanceof FuncCall) { diff --git a/rules/Php80/Rector/Identical/StrEndsWithRector.php b/rules/Php80/Rector/Identical/StrEndsWithRector.php index abca00117c1..1a5228a8534 100644 --- a/rules/Php80/Rector/Identical/StrEndsWithRector.php +++ b/rules/Php80/Rector/Identical/StrEndsWithRector.php @@ -126,7 +126,7 @@ public function providePolyfillPackage(): string * $isMatch = substr($haystack, -strlen($needle)) === $needle; * $isMatch = 'needle' === substr($haystack, -6) */ - private function refactorSubstr(BinaryOp $binaryOp): FuncCall | BooleanNot | null + private function refactorSubstr(BinaryOp $binaryOp): FuncCall|BooleanNot|null { if ($binaryOp->left instanceof FuncCall && $this->isName($binaryOp->left, 'substr')) { $substrFuncCall = $binaryOp->left; @@ -163,7 +163,7 @@ private function refactorSubstr(BinaryOp $binaryOp): FuncCall | BooleanNot | nul return $this->buildReturnNode($haystack, $comparedNeedleExpr, $isPositive); } - private function refactorSubstrCompare(BinaryOp $binaryOp): FuncCall | BooleanNot | null + private function refactorSubstrCompare(BinaryOp $binaryOp): FuncCall|BooleanNot|null { $funcCallAndExpr = $this->binaryOpAnalyzer->matchFuncCallAndOtherExpr($binaryOp, 'substr_compare'); @@ -252,7 +252,7 @@ private function isHardCodedLNumberAndString(Expr $substrOffset, Expr $needle): return $lNumber->value === strlen($needle->value); } - private function buildReturnNode(Expr $haystack, Expr $needle, bool $isPositive): FuncCall | BooleanNot + private function buildReturnNode(Expr $haystack, Expr $needle, bool $isPositive): FuncCall|BooleanNot { $funcCall = $this->nodeFactory->createFuncCall('str_ends_with', [$haystack, $needle]); diff --git a/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php b/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php index 38b33743a35..816db9cf2f7 100644 --- a/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php +++ b/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php @@ -213,7 +213,7 @@ private function removeReadOnlyDoc(Property|Param $node): void $this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node); } - private function refactorParam(Class_ $class, ClassMethod $classMethod, Param $param, Scope $scope): Param | null + private function refactorParam(Class_ $class, ClassMethod $classMethod, Param $param, Scope $scope): Param|null { if (! $this->visibilityManipulator->hasVisibility($param, Visibility::PRIVATE)) { return null; diff --git a/rules/Privatization/NodeManipulator/VisibilityManipulator.php b/rules/Privatization/NodeManipulator/VisibilityManipulator.php index 078a9fe16ad..1ce24b21298 100644 --- a/rules/Privatization/NodeManipulator/VisibilityManipulator.php +++ b/rules/Privatization/NodeManipulator/VisibilityManipulator.php @@ -18,7 +18,7 @@ */ final class VisibilityManipulator { - public function hasVisibility(Class_ | ClassMethod | Property | ClassConst | Param $node, int $visibility): bool + public function hasVisibility(Class_|ClassMethod|Property|ClassConst|Param $node, int $visibility): bool { return (bool) ($node->flags & $visibility); } @@ -26,7 +26,7 @@ public function hasVisibility(Class_ | ClassMethod | Property | ClassConst | Par /** * @api */ - public function makeStatic(ClassMethod | Property | ClassConst | Param $node): void + public function makeStatic(ClassMethod|Property|ClassConst|Param $node): void { $this->addVisibilityFlag($node, Visibility::STATIC); } @@ -34,7 +34,7 @@ public function makeStatic(ClassMethod | Property | ClassConst | Param $node): v /** * @api */ - public function makeNonStatic(ClassMethod | Property $node): void + public function makeNonStatic(ClassMethod|Property $node): void { if (! $node->isStatic()) { return; @@ -46,7 +46,7 @@ public function makeNonStatic(ClassMethod | Property $node): void /** * @api */ - public function makeNonAbstract(ClassMethod | Class_ $node): void + public function makeNonAbstract(ClassMethod|Class_ $node): void { if (! $node->isAbstract()) { return; @@ -58,7 +58,7 @@ public function makeNonAbstract(ClassMethod | Class_ $node): void /** * @api */ - public function makeFinal(Class_ | ClassMethod | Param | ClassConst $node): void + public function makeFinal(Class_|ClassMethod|Param|ClassConst $node): void { $this->addVisibilityFlag($node, Visibility::FINAL); } @@ -66,7 +66,7 @@ public function makeFinal(Class_ | ClassMethod | Param | ClassConst $node): void /** * @api */ - public function makeNonFinal(Class_ | ClassMethod | Param $node): void + public function makeNonFinal(Class_|ClassMethod|Param $node): void { if (! $this->hasVisibility($node, Visibility::FINAL)) { return; @@ -75,7 +75,7 @@ public function makeNonFinal(Class_ | ClassMethod | Param $node): void $node->flags -= Modifiers::FINAL; } - public function changeNodeVisibility(ClassMethod | Property | ClassConst $node, int $visibility): void + public function changeNodeVisibility(ClassMethod|Property|ClassConst $node, int $visibility): void { Assert::oneOf($visibility, [ Visibility::PUBLIC, @@ -89,7 +89,7 @@ public function changeNodeVisibility(ClassMethod | Property | ClassConst $node, $this->replaceVisibilityFlag($node, $visibility); } - public function makePublic(ClassMethod | Property | ClassConst | Param $node): void + public function makePublic(ClassMethod|Property|ClassConst|Param $node): void { $this->replaceVisibilityFlag($node, Visibility::PUBLIC); } @@ -97,12 +97,12 @@ public function makePublic(ClassMethod | Property | ClassConst | Param $node): v /** * @api */ - public function makeProtected(ClassMethod | Property | ClassConst $node): void + public function makeProtected(ClassMethod|Property|ClassConst $node): void { $this->replaceVisibilityFlag($node, Visibility::PROTECTED); } - public function makePrivate(ClassMethod | Property | ClassConst | Param $node): void + public function makePrivate(ClassMethod|Property|ClassConst|Param $node): void { $this->replaceVisibilityFlag($node, Visibility::PRIVATE); } @@ -110,12 +110,12 @@ public function makePrivate(ClassMethod | Property | ClassConst | Param $node): /** * @api */ - public function removeFinal(Class_ | ClassConst $node): void + public function removeFinal(Class_|ClassConst $node): void { $node->flags -= Modifiers::FINAL; } - public function makeReadonly(Class_ | Property | Param $node): void + public function makeReadonly(Class_|Property|Param $node): void { $this->addVisibilityFlag($node, Visibility::READONLY); } @@ -123,12 +123,12 @@ public function makeReadonly(Class_ | Property | Param $node): void /** * @api */ - public function isReadonly(Class_ | Property | Param $node): bool + public function isReadonly(Class_|Property|Param $node): bool { return $this->hasVisibility($node, Visibility::READONLY); } - public function removeReadonly(Class_ | Property | Param $node): void + public function removeReadonly(Class_|Property|Param $node): void { $isConstructorPromotionBefore = $node instanceof Param && $node->isPromoted(); @@ -164,7 +164,7 @@ public function publicize(ClassConst|ClassMethod|Property $node): ClassConst|Cla /** * This way "abstract", "static", "final" are kept */ - private function removeVisibility(ClassMethod | Property | ClassConst | Param $node): void + private function removeVisibility(ClassMethod|Property|ClassConst|Param $node): void { // no modifier if ($node->flags === 0) { @@ -189,13 +189,13 @@ private function removeVisibility(ClassMethod | Property | ClassConst | Param $n * @api */ private function addVisibilityFlag( - Class_ | ClassMethod | Property | ClassConst | Param $node, + Class_|ClassMethod|Property|ClassConst|Param $node, int $visibility ): void { $node->flags |= $visibility; } - private function replaceVisibilityFlag(ClassMethod | Property | ClassConst | Param $node, int $visibility): void + private function replaceVisibilityFlag(ClassMethod|Property|ClassConst|Param $node, int $visibility): void { $isStatic = $node instanceof ClassMethod && $node->isStatic(); if ($isStatic) { diff --git a/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php b/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php index 60302e1c3d2..138e0abbfde 100644 --- a/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php +++ b/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php @@ -68,7 +68,7 @@ public function getNodeTypes(): array /** * @param MethodCall|StaticCall|ClassMethod $node */ - public function refactor(Node $node): MethodCall | StaticCall | ClassMethod | null + public function refactor(Node $node): MethodCall|StaticCall|ClassMethod|null { $this->hasChanged = false; @@ -104,7 +104,7 @@ public function configure(array $configuration): void } private function processPosition( - ClassMethod | StaticCall | MethodCall $node, + ClassMethod|StaticCall|MethodCall $node, ArgumentRemover $argumentRemover ): void { if ($argumentRemover->getValue() === null) { @@ -138,7 +138,7 @@ private function processPosition( } } - private function removeByName(ClassMethod | StaticCall | MethodCall $node, int $position, string $name): void + private function removeByName(ClassMethod|StaticCall|MethodCall $node, int $position, string $name): void { if ($node instanceof MethodCall || $node instanceof StaticCall) { if (isset($node->args[$position]) && $this->isName($node->args[$position], $name)) { diff --git a/rules/Transform/NodeAnalyzer/FuncCallStaticCallToMethodCallAnalyzer.php b/rules/Transform/NodeAnalyzer/FuncCallStaticCallToMethodCallAnalyzer.php index c6dec629b46..da0fde8e337 100644 --- a/rules/Transform/NodeAnalyzer/FuncCallStaticCallToMethodCallAnalyzer.php +++ b/rules/Transform/NodeAnalyzer/FuncCallStaticCallToMethodCallAnalyzer.php @@ -36,7 +36,7 @@ public function matchTypeProvidingExpr( Class_ $class, ClassMethod $classMethod, ObjectType $objectType, - ): MethodCall | PropertyFetch | Variable | null { + ): MethodCall|PropertyFetch|Variable|null { $expr = $this->typeProvidingExprFromClassResolver->resolveTypeProvidingExprFromClass( $class, $classMethod, @@ -68,7 +68,7 @@ public function matchTypeProvidingExpr( private function addClassMethodParamForVariable( Variable $variable, ObjectType $objectType, - ClassMethod | Function_ $functionLike + ClassMethod|Function_ $functionLike ): void { /** @var string $variableName */ $variableName = $this->nodeNameResolver->getName($variable); diff --git a/rules/TypeDeclaration/NodeAnalyzer/AutowiredClassMethodOrPropertyAnalyzer.php b/rules/TypeDeclaration/NodeAnalyzer/AutowiredClassMethodOrPropertyAnalyzer.php index ab6391ecf28..1335c098bd7 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/AutowiredClassMethodOrPropertyAnalyzer.php +++ b/rules/TypeDeclaration/NodeAnalyzer/AutowiredClassMethodOrPropertyAnalyzer.php @@ -40,7 +40,7 @@ public function matchAutowiredMethodInClass(Class_ $class): ?ClassMethod return null; } - public function detect(ClassMethod | Param | Property $node): bool + public function detect(ClassMethod|Param|Property $node): bool { $nodePhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node); if ($nodePhpDocInfo->hasByNames(['required', 'inject'])) { diff --git a/rules/TypeDeclaration/NodeAnalyzer/CallerParamMatcher.php b/rules/TypeDeclaration/NodeAnalyzer/CallerParamMatcher.php index d51f69eaa78..ac507454878 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/CallerParamMatcher.php +++ b/rules/TypeDeclaration/NodeAnalyzer/CallerParamMatcher.php @@ -40,7 +40,7 @@ public function __construct( public function matchCallParamType( Param $param, Param $callParam - ): null | Identifier | Name | NullableType | UnionType | ComplexType { + ): null|Identifier|Name|NullableType|UnionType|ComplexType { if (! $callParam->type instanceof Node) { return null; } @@ -101,7 +101,7 @@ public function matchParentParam(StaticCall $parentStaticCall, Param $param, Sco return $this->resolveParentMethodParam($scope, $methodName, $parentStaticCallArgPosition); } - public function matchCallParam(StaticCall | MethodCall | FuncCall $call, Param $param): ?Param + public function matchCallParam(StaticCall|MethodCall|FuncCall $call, Param $param): ?Param { $callArgPosition = $this->matchCallArgPosition($call, $param); if ($callArgPosition === null) { @@ -116,7 +116,7 @@ public function matchCallParam(StaticCall | MethodCall | FuncCall $call, Param $ return $classMethodOrFunction->params[$callArgPosition] ?? null; } - private function matchCallArgPosition(StaticCall | MethodCall | FuncCall $call, Param $param): int | null + private function matchCallArgPosition(StaticCall|MethodCall|FuncCall $call, Param $param): int|null { $paramName = $this->nodeNameResolver->getName($param); diff --git a/rules/TypeDeclaration/NodeAnalyzer/NeverFuncCallAnalyzer.php b/rules/TypeDeclaration/NodeAnalyzer/NeverFuncCallAnalyzer.php index f0a55482043..69b9b582fa8 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/NeverFuncCallAnalyzer.php +++ b/rules/TypeDeclaration/NodeAnalyzer/NeverFuncCallAnalyzer.php @@ -19,7 +19,7 @@ public function __construct( ) { } - public function hasNeverFuncCall(ClassMethod | Closure | Function_ $functionLike): bool + public function hasNeverFuncCall(ClassMethod|Closure|Function_ $functionLike): bool { return array_any((array) $functionLike->stmts, fn (Stmt $stmt): bool => $this->isWithNeverTypeExpr($stmt)); } diff --git a/rules/TypeDeclaration/NodeAnalyzer/VariableInSprintfMaskMatcher.php b/rules/TypeDeclaration/NodeAnalyzer/VariableInSprintfMaskMatcher.php index 91f2f697a38..f23ae12ffac 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/VariableInSprintfMaskMatcher.php +++ b/rules/TypeDeclaration/NodeAnalyzer/VariableInSprintfMaskMatcher.php @@ -80,7 +80,7 @@ public function matchMask( continue; } - if (! $this-> nodeNameResolver->isName($arg->value, $variableName)) { + if (! $this->nodeNameResolver->isName($arg->value, $variableName)) { continue; } diff --git a/rules/TypeDeclaration/NodeManipulator/AddNeverReturnType.php b/rules/TypeDeclaration/NodeManipulator/AddNeverReturnType.php index 7e1ec4759f4..c5a74d67293 100644 --- a/rules/TypeDeclaration/NodeManipulator/AddNeverReturnType.php +++ b/rules/TypeDeclaration/NodeManipulator/AddNeverReturnType.php @@ -44,7 +44,7 @@ public function add(ClassMethod|Function_|Closure $node, Scope $scope): ClassMet return $node; } - private function shouldSkip(ClassMethod | Function_ | Closure $node, Scope $scope): bool + private function shouldSkip(ClassMethod|Function_|Closure $node, Scope $scope): bool { // already has return type, and non-void // it can be "never" return itself, or other return type diff --git a/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php b/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php index 10e30330fe7..a1854926c9a 100644 --- a/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php +++ b/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php @@ -43,7 +43,7 @@ public function narrowToFullyQualifiedOrAliasedObjectType( ObjectType $objectType, Scope|null $scope, bool $withPreslash = false - ): TypeWithClassName | NonExistingObjectType | UnionType | MixedType | TemplateType { + ): TypeWithClassName|NonExistingObjectType|UnionType|MixedType|TemplateType { $className = ltrim($objectType->getClassName(), '\\'); if (str_starts_with($objectType->getClassName(), '\\')) { return new FullyQualifiedObjectType($className); diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php index 5d0c483d83f..a7651727140 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php @@ -156,7 +156,7 @@ public function refactor(Node $node): ?Node return null; } - private function isUnionPossibleReturnsVoid(ClassMethod | Function_ | Closure $node): bool + private function isUnionPossibleReturnsVoid(ClassMethod|Function_|Closure $node): bool { $inferReturnType = $this->returnTypeInferer->inferFunctionLike($node); if ($inferReturnType instanceof UnionType) { @@ -171,10 +171,10 @@ private function isUnionPossibleReturnsVoid(ClassMethod | Function_ | Closure $n } private function processSingleUnionType( - ClassMethod | Function_ | Closure $node, + ClassMethod|Function_|Closure $node, UnionType $unionType, NullableType $nullableType - ): Closure | ClassMethod | Function_ { + ): Closure|ClassMethod|Function_ { $types = $unionType->getTypes(); $returnType = $types[0] instanceof ObjectType && $types[1]->isNull()->yes() ? new NullableType(new FullyQualified($types[0]->getClassName())) @@ -184,7 +184,7 @@ private function processSingleUnionType( return $node; } - private function shouldSkip(ClassMethod | Function_ | Closure $node, Scope $scope): bool + private function shouldSkip(ClassMethod|Function_|Closure $node, Scope $scope): bool { if ($node->returnType instanceof Node) { return true; @@ -203,8 +203,8 @@ private function shouldSkip(ClassMethod | Function_ | Closure $node, Scope $scop private function refactorSingleReturnType( Return_ $return, Identifier|Name|NullableType|ComplexType $returnedStrictTypeNode, - ClassMethod | Function_ | Closure $functionLike - ): Closure | ClassMethod | Function_ { + ClassMethod|Function_|Closure $functionLike + ): Closure|ClassMethod|Function_ { $resolvedType = $this->nodeTypeResolver->getType($return); if ($resolvedType instanceof UnionType) { diff --git a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php index eb36169dd42..62f859477c6 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php @@ -116,7 +116,8 @@ public function refactor(Node $node): ?Node if ($value instanceof MixedType) { $values = []; break; - } elseif ($value instanceof UnionType) { + } + if ($value instanceof UnionType) { $values = [...$values, ...$value->getTypes()]; } } @@ -125,7 +126,8 @@ public function refactor(Node $node): ?Node if ($key instanceof MixedType) { $keys = []; break; - } elseif ($key instanceof UnionType) { + } + if ($key instanceof UnionType) { $keys = [...$keys, ...$key->getTypes()]; } } diff --git a/rules/TypeDeclaration/TypeAnalyzer/ParameterTypeFromDataProviderResolver.php b/rules/TypeDeclaration/TypeAnalyzer/ParameterTypeFromDataProviderResolver.php index f24d7e72517..9d008d69a37 100644 --- a/rules/TypeDeclaration/TypeAnalyzer/ParameterTypeFromDataProviderResolver.php +++ b/rules/TypeDeclaration/TypeAnalyzer/ParameterTypeFromDataProviderResolver.php @@ -109,7 +109,7 @@ private function resolveYieldStaticArrayTypeByParameterPosition(array $yields, i return $this->typeFactory->createMixedPassedOrUnionType($paramOnPositionTypes); } - private function getTypeFromClassMethodYield(Array_ $classMethodYieldArray): MixedType | ConstantArrayType + private function getTypeFromClassMethodYield(Array_ $classMethodYieldArray): MixedType|ConstantArrayType { $arrayType = $this->nodeTypeResolver->getType($classMethodYieldArray); diff --git a/rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php b/rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php index 59774b41d07..978e0c9fdc7 100644 --- a/rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php +++ b/rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php @@ -90,7 +90,7 @@ public function collectStrictReturnTypes(array $returns, Scope $scope): array return $this->typeNodeUnwrapper->uniquateNodes($returnedStrictTypeNodes); } - public function resolveMethodCallReturnNode(MethodCall | StaticCall | FuncCall $call): ?Node + public function resolveMethodCallReturnNode(MethodCall|StaticCall|FuncCall $call): ?Node { $returnType = $this->resolveMethodCallReturnType($call); if (! $returnType instanceof Type) { @@ -100,7 +100,7 @@ public function resolveMethodCallReturnNode(MethodCall | StaticCall | FuncCall $ return $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($returnType, TypeKind::RETURN); } - public function resolveMethodCallReturnType(MethodCall | StaticCall | FuncCall $call): ?Type + public function resolveMethodCallReturnType(MethodCall|StaticCall|FuncCall $call): ?Type { $methodReflection = $this->reflectionResolver->resolveFunctionLikeReflectionFromCall($call); if ($methodReflection === null) { @@ -138,7 +138,7 @@ public function resolveMethodCallReturnType(MethodCall | StaticCall | FuncCall $ return $this->normalizeStaticType($call, $returnType); } - private function normalizeStaticType(MethodCall | StaticCall | FuncCall $call, Type $type): Type + private function normalizeStaticType(MethodCall|StaticCall|FuncCall $call, Type $type): Type { $reflectionClass = $this->reflectionResolver->resolveClassReflection($call); $currentClassName = $reflectionClass instanceof ClassReflection diff --git a/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php b/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php index ca18286b132..8cc170c046a 100644 --- a/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php +++ b/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php @@ -49,7 +49,7 @@ public function __construct( ) { } - public function hasExclusiveVoid(ClassMethod | Closure | Function_ $functionLike): bool + public function hasExclusiveVoid(ClassMethod|Closure|Function_ $functionLike): bool { $classReflection = $this->reflectionResolver->resolveClassReflection($functionLike); if ($classReflection instanceof ClassReflection && $classReflection->isInterface()) { diff --git a/rules/TypeDeclarationDocblocks/NodeAnalyzer/ConstructorAssignedTypeResolver.php b/rules/TypeDeclarationDocblocks/NodeAnalyzer/ConstructorAssignedTypeResolver.php index 913af1ba7a7..76dae2e5927 100644 --- a/rules/TypeDeclarationDocblocks/NodeAnalyzer/ConstructorAssignedTypeResolver.php +++ b/rules/TypeDeclarationDocblocks/NodeAnalyzer/ConstructorAssignedTypeResolver.php @@ -41,11 +41,11 @@ public function resolve(Class_ $class, string $propertyName): ?Type } $propertyFetch = $assign->var; - if (! $this->nodeNameResolver-> isName($propertyFetch->var, 'this')) { + if (! $this->nodeNameResolver->isName($propertyFetch->var, 'this')) { continue; } - if (! $this->nodeNameResolver-> isName($propertyFetch->name, $propertyName)) { + if (! $this->nodeNameResolver->isName($propertyFetch->name, $propertyName)) { continue; } diff --git a/rules/TypeDeclarationDocblocks/TypeResolver/YieldTypeResolver.php b/rules/TypeDeclarationDocblocks/TypeResolver/YieldTypeResolver.php index e3bbc4b68b0..145a78a66c2 100644 --- a/rules/TypeDeclarationDocblocks/TypeResolver/YieldTypeResolver.php +++ b/rules/TypeDeclarationDocblocks/TypeResolver/YieldTypeResolver.php @@ -48,7 +48,7 @@ public function resolveFromYieldNodes( return new FullyQualifiedGenericObjectType($className, [$yieldedTypes]); } - private function resolveYieldValue(Yield_ | YieldFrom $yield): ?Expr + private function resolveYieldValue(Yield_|YieldFrom $yield): ?Expr { if ($yield instanceof Yield_) { return $yield->value; diff --git a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php index e406d0f2195..5b47f9d9585 100644 --- a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php +++ b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php @@ -624,7 +624,7 @@ private function resolveInlineGenericUsesReferenceClassNames(string $reference): return [$resolvedClassName]; } - private function getTypeOrMixed(?PhpDocTagValueNode $phpDocTagValueNode): MixedType | Type + private function getTypeOrMixed(?PhpDocTagValueNode $phpDocTagValueNode): MixedType|Type { if (! $phpDocTagValueNode instanceof PhpDocTagValueNode) { return new MixedType(); diff --git a/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php b/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php index 79fbfe00660..3201d33f527 100644 --- a/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php +++ b/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php @@ -56,7 +56,7 @@ public function resolveAnnotationMethodCall(BetterTokenIterator $tokenIterator, public function resolveAnnotationValue( BetterTokenIterator $tokenIterator, Node $currentPhpNode - ): CurlyListNode | string | array | ConstExprNode | DoctrineAnnotationTagValueNode | StringNode { + ): CurlyListNode|string|array|ConstExprNode|DoctrineAnnotationTagValueNode|StringNode { // skips dummy tokens like newlines $tokenIterator->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); @@ -126,7 +126,7 @@ private function resolveAnnotationValues(BetterTokenIterator $tokenIterator, Nod private function parseValue( BetterTokenIterator $tokenIterator, Node $currentPhpNode - ): CurlyListNode | string | array | ConstExprNode | DoctrineAnnotationTagValueNode | StringNode { + ): CurlyListNode|string|array|ConstExprNode|DoctrineAnnotationTagValueNode|StringNode { if ($tokenIterator->isCurrentTokenType(Lexer::TOKEN_OPEN_CURLY_BRACKET)) { $items = $this->arrayParser->parseCurlyArray($tokenIterator, $currentPhpNode); return new CurlyListNode($items); diff --git a/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/PlainValueParser.php b/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/PlainValueParser.php index c6d7e9da51e..01d876dcc68 100644 --- a/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/PlainValueParser.php +++ b/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/PlainValueParser.php @@ -43,7 +43,7 @@ public function autowire( public function parseValue( BetterTokenIterator $tokenIterator, Node $currentPhpNode - ): string | array | ConstExprNode | DoctrineAnnotationTagValueNode | StringNode { + ): string|array|ConstExprNode|DoctrineAnnotationTagValueNode|StringNode { $currentTokenValue = $tokenIterator->currentTokenValue(); // temporary hackaround multi-line doctrine annotations @@ -125,7 +125,7 @@ private function parseMultilineOrWhiteSpacedString( $tokenIterator->currentTokenValue(), '"' ) && $currentTokenValue !== $tokenIterator->currentTokenValue()) { - //starts with '"' and current token contains '"', should be the end + // starts with '"' and current token contains '"', should be the end $currentTokenValue .= substr( $tokenIterator->currentTokenValue(), 0, @@ -174,7 +174,7 @@ private function parseNestedDoctrineAnnotationTagValueNode( return new DoctrineAnnotationTagValueNode($identifierTypeNode, $annotationShortName, $values); } - private function matchConstantValue(string $currentTokenValue): ConstExprNode | null + private function matchConstantValue(string $currentTokenValue): ConstExprNode|null { if (strtolower($currentTokenValue) === 'false') { return new ConstExprFalseNode(); diff --git a/src/Caching/ValueObject/Storage/FileCacheStorage.php b/src/Caching/ValueObject/Storage/FileCacheStorage.php index 94a4172cf8f..b883cb4b9ae 100644 --- a/src/Caching/ValueObject/Storage/FileCacheStorage.php +++ b/src/Caching/ValueObject/Storage/FileCacheStorage.php @@ -50,7 +50,7 @@ public function load(string $key, string $variableKey): mixed public function save(string $key, string $variableKey, mixed $data): void { $cacheFilePaths = $this->getCacheFilePaths($key); - $this->filesystem-> mkdir($cacheFilePaths->getFirstDirectory()); + $this->filesystem->mkdir($cacheFilePaths->getFirstDirectory()); $this->filesystem->mkdir($cacheFilePaths->getSecondDirectory()); $filePath = $cacheFilePaths->getFilePath(); diff --git a/src/Comments/CommentRemover.php b/src/Comments/CommentRemover.php index da2e5d00469..ebb4dbf5290 100644 --- a/src/Comments/CommentRemover.php +++ b/src/Comments/CommentRemover.php @@ -21,7 +21,7 @@ public function __construct( * @param Node[]|Node|null $node * @return Node[]|null */ - public function removeFromNode(array | Node | null $node): array | null + public function removeFromNode(array|Node|null $node): array|null { if ($node === null) { return null; diff --git a/src/Configuration/ConfigurationFactory.php b/src/Configuration/ConfigurationFactory.php index 788370cf407..8f52a7a2111 100644 --- a/src/Configuration/ConfigurationFactory.php +++ b/src/Configuration/ConfigurationFactory.php @@ -181,7 +181,7 @@ private function setFilesWithoutExtensionParameter(array $paths): void } } - private function resolveMemoryLimit(InputInterface $input): string | null + private function resolveMemoryLimit(InputInterface $input): string|null { $memoryLimit = $input->getOption(Option::MEMORY_LIMIT); if ($memoryLimit !== null) { diff --git a/src/Configuration/OnlyRuleResolver.php b/src/Configuration/OnlyRuleResolver.php index e4f3ad52c1f..39a49e50872 100644 --- a/src/Configuration/OnlyRuleResolver.php +++ b/src/Configuration/OnlyRuleResolver.php @@ -23,10 +23,10 @@ public function __construct( public function resolve(string $rule): string { - //fix wrongly double escaped backslashes + // fix wrongly double escaped backslashes $rule = str_replace('\\\\', '\\', $rule); - //remove single quotes appearing when single-quoting arguments on windows + // remove single quotes appearing when single-quoting arguments on windows if (str_starts_with($rule, "'") && str_ends_with($rule, "'")) { $rule = substr($rule, 1, -1); } @@ -39,7 +39,7 @@ public function resolve(string $rule): string } } - //allow short rule names if there are not duplicates + // allow short rule names if there are not duplicates $matching = []; foreach ($this->rectors as $rector) { if (str_ends_with($rector::class, '\\' . $rule)) { diff --git a/src/FamilyTree/Reflection/FamilyRelationsAnalyzer.php b/src/FamilyTree/Reflection/FamilyRelationsAnalyzer.php index a2a5282a60b..918a5ab5c8c 100644 --- a/src/FamilyTree/Reflection/FamilyRelationsAnalyzer.php +++ b/src/FamilyTree/Reflection/FamilyRelationsAnalyzer.php @@ -23,7 +23,7 @@ public function __construct( * @api * @return string[] */ - public function getClassLikeAncestorNames(Class_ | Interface_ | Name $classOrName): array + public function getClassLikeAncestorNames(Class_|Interface_|Name $classOrName): array { $ancestorNames = []; diff --git a/src/NodeAnalyzer/PropertyPresenceChecker.php b/src/NodeAnalyzer/PropertyPresenceChecker.php index 434c47a6865..96412ed75f3 100644 --- a/src/NodeAnalyzer/PropertyPresenceChecker.php +++ b/src/NodeAnalyzer/PropertyPresenceChecker.php @@ -35,7 +35,7 @@ public function hasClassContextProperty(Class_ $class, DefinedPropertyWithType $ public function getClassContextProperty( Class_ $class, DefinedPropertyWithType|PropertyMetadata $definedPropertyWithType - ): Property | Param | null { + ): Property|Param|null { $className = $this->nodeNameResolver->getName($class); if ($className === null) { return null; diff --git a/src/NodeAnalyzer/VariadicAnalyzer.php b/src/NodeAnalyzer/VariadicAnalyzer.php index 6c0b1b382ff..c786618c15e 100644 --- a/src/NodeAnalyzer/VariadicAnalyzer.php +++ b/src/NodeAnalyzer/VariadicAnalyzer.php @@ -20,7 +20,7 @@ public function __construct( ) { } - public function hasVariadicParameters(FuncCall | StaticCall | MethodCall | New_ $call): bool + public function hasVariadicParameters(FuncCall|StaticCall|MethodCall|New_ $call): bool { $functionLikeReflection = $this->reflectionResolver->resolveFunctionLikeReflectionFromCall($call); if ($functionLikeReflection === null) { @@ -30,7 +30,7 @@ public function hasVariadicParameters(FuncCall | StaticCall | MethodCall | New_ return $this->hasVariadicVariant($functionLikeReflection); } - private function hasVariadicVariant(MethodReflection | FunctionReflection $functionLikeReflection): bool + private function hasVariadicVariant(MethodReflection|FunctionReflection $functionLikeReflection): bool { return array_any( $functionLikeReflection->getVariants(), diff --git a/src/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php b/src/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php index d655ca56113..ab59b865bae 100644 --- a/src/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php +++ b/src/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php @@ -48,7 +48,7 @@ public function match( Array_ $array, Scope $scope, ?string $classMethodName = null - ): null | ArrayCallableDynamicMethod | ArrayCallable { + ): null|ArrayCallableDynamicMethod|ArrayCallable { if (count($array->items) !== 2) { return null; } @@ -141,7 +141,7 @@ private function resolveClassContextType( ClassConstFetch|Class_ $classContext, Scope $scope, ?string $classMethodName - ): MixedType | ObjectType { + ): MixedType|ObjectType { $classConstantReference = $this->valueResolver->getValue($classContext); // non-class value diff --git a/src/NodeDecorator/CreatedByRuleDecorator.php b/src/NodeDecorator/CreatedByRuleDecorator.php index cd159c1e8d0..0843e006e6e 100644 --- a/src/NodeDecorator/CreatedByRuleDecorator.php +++ b/src/NodeDecorator/CreatedByRuleDecorator.php @@ -14,7 +14,7 @@ final class CreatedByRuleDecorator * @param array|Node $node * @param class-string $rectorClass */ - public function decorate(array | Node $node, Node $originalNode, string $rectorClass): void + public function decorate(array|Node $node, Node $originalNode, string $rectorClass): void { if ($node instanceof Node && $node === $originalNode) { $this->createByRule($node, $rectorClass); diff --git a/src/NodeManipulator/ClassInsertManipulator.php b/src/NodeManipulator/ClassInsertManipulator.php index 21e665ec86a..fda1ab7fd16 100644 --- a/src/NodeManipulator/ClassInsertManipulator.php +++ b/src/NodeManipulator/ClassInsertManipulator.php @@ -22,7 +22,7 @@ public function __construct( /** * @api */ - public function addAsFirstMethod(Class_ $class, Property | ClassConst | ClassMethod $addedStmt): void + public function addAsFirstMethod(Class_ $class, Property|ClassConst|ClassMethod $addedStmt): void { $scope = $class->getAttribute(AttributeKey::SCOPE); $addedStmt->setAttribute(AttributeKey::SCOPE, $scope); diff --git a/src/NodeManipulator/PropertyManipulator.php b/src/NodeManipulator/PropertyManipulator.php index 50f27addc7e..6e081d6bcaf 100644 --- a/src/NodeManipulator/PropertyManipulator.php +++ b/src/NodeManipulator/PropertyManipulator.php @@ -73,7 +73,7 @@ public function __construct( public function isPropertyChangeableExceptConstructor( Class_ $class, - Property | Param $propertyOrParam, + Property|Param $propertyOrParam, Scope $scope ): bool { $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($class); diff --git a/src/NodeNameResolver/NodeNameResolver.php b/src/NodeNameResolver/NodeNameResolver.php index 620ea64ecbd..11cf3b5a490 100644 --- a/src/NodeNameResolver/NodeNameResolver.php +++ b/src/NodeNameResolver/NodeNameResolver.php @@ -68,7 +68,7 @@ public function isNames(Node $node, array $names): bool * @param Node|Node[] $node * @param MethodName::*|string $name */ - public function isName(Node | array $node, string $name): bool + public function isName(Node|array $node, string $name): bool { $nodes = is_array($node) ? $node : [$node]; return array_any($nodes, fn (Node $node): bool => $this->isSingleName($node, $name)); @@ -89,7 +89,7 @@ public function isName(Node | array $node, string $name): bool * ($node is Name ? string : * string|null ))))))))) */ - public function getName(Node | string $node): ?string + public function getName(Node|string $node): ?string { if (is_string($node)) { return $node; @@ -161,7 +161,7 @@ public function getNames(array $nodes): array return $names; } - public function getShortName(string | Name | Identifier | ClassLike $name): string + public function getShortName(string|Name|Identifier|ClassLike $name): string { return $this->classNaming->getShortName($name); } diff --git a/src/NodeNestingScope/ContextAnalyzer.php b/src/NodeNestingScope/ContextAnalyzer.php index ece022ee036..40588d7e85c 100644 --- a/src/NodeNestingScope/ContextAnalyzer.php +++ b/src/NodeNestingScope/ContextAnalyzer.php @@ -29,7 +29,7 @@ public function isInIf(Node $node): bool } public function isChangeableContext( - PropertyFetch | StaticPropertyFetch | NullsafePropertyFetch $propertyFetch + PropertyFetch|StaticPropertyFetch|NullsafePropertyFetch $propertyFetch ): bool { if ($propertyFetch->getAttribute(AttributeKey::IS_UNSET_VAR, false)) { return true; diff --git a/src/NodeTypeResolver/NodeTypeResolver/NameTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver/NameTypeResolver.php index 94a90f36b59..53fb8eb556e 100644 --- a/src/NodeTypeResolver/NodeTypeResolver/NameTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver/NameTypeResolver.php @@ -60,7 +60,7 @@ private function resolveClassReflection(Name|FullyQualified $node): ?ClassReflec return $scope->getClassReflection(); } - private function resolveParent(Name $name): MixedType | ObjectType | UnionType + private function resolveParent(Name $name): MixedType|ObjectType|UnionType { $classReflection = $this->resolveClassReflection($name); if (! $classReflection instanceof ClassReflection || ! $classReflection->isClass()) { diff --git a/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php b/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php index d66d08bd15d..7c73de9d1ab 100644 --- a/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php +++ b/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php @@ -149,7 +149,6 @@ public function processNodes( * The stmts must be array of Stmt, or it will be silently skipped by PHPStan * @see vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php:282 */ - Assert::allIsInstanceOf($stmts, Stmt::class); $scope = $formerMutatingScope ?? $this->scopeFactory->createFromFile($filePath); @@ -652,7 +651,7 @@ private function processTernary(Ternary $ternary, MutatingScope $mutatingScope): } private function resolveClassOrInterfaceScope( - Class_ | Interface_ | Enum_ $classLike, + Class_|Interface_|Enum_ $classLike, MutatingScope $mutatingScope ): MutatingScope { $isAnonymous = $this->classAnalyzer->isAnonymousClass($classLike); @@ -685,7 +684,7 @@ private function resolveClassOrInterfaceScope( return $mutatingScope; } - private function resolveClassName(Class_ | Interface_ | Trait_| Enum_ $classLike): string + private function resolveClassName(Class_|Interface_|Trait_|Enum_ $classLike): string { if ($classLike->namespacedName instanceof Name) { return (string) $classLike->namespacedName; diff --git a/src/NodeTypeResolver/PhpDocNodeVisitor/NameImportingPhpDocNodeVisitor.php b/src/NodeTypeResolver/PhpDocNodeVisitor/NameImportingPhpDocNodeVisitor.php index 6a8be942bc4..7bcca246f24 100644 --- a/src/NodeTypeResolver/PhpDocNodeVisitor/NameImportingPhpDocNodeVisitor.php +++ b/src/NodeTypeResolver/PhpDocNodeVisitor/NameImportingPhpDocNodeVisitor.php @@ -239,7 +239,7 @@ private function processDoctrineAnnotationTagValueNode( private function enterSpacelessPhpDocTagNode( SpacelessPhpDocTagNode $spacelessPhpDocTagNode - ): SpacelessPhpDocTagNode | null { + ): SpacelessPhpDocTagNode|null { if (! $spacelessPhpDocTagNode->value instanceof DoctrineAnnotationTagValueNode) { return null; } diff --git a/src/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php b/src/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php index 2aad87d60eb..c48d970c288 100644 --- a/src/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php @@ -41,7 +41,7 @@ public function mapToPHPStanPhpDocTypeNode(Type $type): TypeNode /** * @param TypeKind::* $typeKind */ - public function mapToPhpParserNode(Type $type, string $typeKind): Name | ComplexType | Identifier | null + public function mapToPhpParserNode(Type $type, string $typeKind): Name|ComplexType|Identifier|null { foreach ($this->typeMappers as $typeMapper) { if (! is_a($type, $typeMapper->getNodeClass(), true)) { diff --git a/src/PhpDocParser/NodeTraverser/SimpleCallableNodeTraverser.php b/src/PhpDocParser/NodeTraverser/SimpleCallableNodeTraverser.php index 1c19421e2e2..7e7e91ea15e 100644 --- a/src/PhpDocParser/NodeTraverser/SimpleCallableNodeTraverser.php +++ b/src/PhpDocParser/NodeTraverser/SimpleCallableNodeTraverser.php @@ -19,7 +19,7 @@ final class SimpleCallableNodeTraverser * @param callable(Node $node): (int|Node|null|Node[]) $callable * @api shortcut helper */ - public static function traverse(Node | array | null $node, callable $callable): void + public static function traverse(Node|array|null $node, callable $callable): void { self::traverseNodesWithCallable($node, $callable); } @@ -28,7 +28,7 @@ public static function traverse(Node | array | null $node, callable $callable): * @param callable(Node $node): (int|Node|null|Node[]) $callable * @param Node|Node[]|null $node */ - public static function traverseNodesWithCallable(Node | array | null $node, callable $callable): void + public static function traverseNodesWithCallable(Node|array|null $node, callable $callable): void { if ($node === null || $node === []) { return; diff --git a/src/PhpParser/AstResolver.php b/src/PhpParser/AstResolver.php index ad67a725a82..58e1d84510c 100644 --- a/src/PhpParser/AstResolver.php +++ b/src/PhpParser/AstResolver.php @@ -66,7 +66,7 @@ public function __construct( /** * @api downgrade */ - public function resolveClassFromName(string $className): Class_ | Trait_ | Interface_ | Enum_ | null + public function resolveClassFromName(string $className): Class_|Trait_|Interface_|Enum_|null { if (! $this->reflectionProvider->hasClass($className)) { return null; @@ -112,8 +112,8 @@ function (Node $node) use ($classLikeName, $methodName, &$classMethod): bool { } public function resolveClassMethodOrFunctionFromCall( - FuncCall | StaticCall | MethodCall | New_ | NullsafeMethodCall $call - ): ClassMethod | Function_ | null { + FuncCall|StaticCall|MethodCall|New_|NullsafeMethodCall $call + ): ClassMethod|Function_|null { if ($call instanceof FuncCall) { return $this->resolveFunctionFromFuncCall($call); } @@ -166,7 +166,7 @@ public function resolveClassMethod(string $className, string $methodName): ?Clas return $classMethod; } - public function resolveClassMethodFromCall(MethodCall | StaticCall | NullsafeMethodCall | New_ $call): ?ClassMethod + public function resolveClassMethodFromCall(MethodCall|StaticCall|NullsafeMethodCall|New_ $call): ?ClassMethod { if ($call instanceof New_) { if ($call->class instanceof Class_) { @@ -200,7 +200,7 @@ public function resolveClassMethodFromCall(MethodCall | StaticCall | NullsafeMet public function resolveClassFromClassReflection( ClassReflection $classReflection - ): Trait_ | Class_ | Interface_ | Enum_ | null { + ): Trait_|Class_|Interface_|Enum_|null { if ($classReflection->isBuiltin()) { return null; } @@ -260,7 +260,7 @@ function (Node $node) use ($traitName): bool { public function resolvePropertyFromPropertyReflection( PhpPropertyReflection $phpPropertyReflection - ): Property | Param | null { + ): Property|Param|null { $classReflection = $phpPropertyReflection->getDeclaringClass(); $fileName = $classReflection->getFileName(); diff --git a/src/PhpParser/Comparing/NodeComparator.php b/src/PhpParser/Comparing/NodeComparator.php index d9d5323c149..b944e1da94c 100644 --- a/src/PhpParser/Comparing/NodeComparator.php +++ b/src/PhpParser/Comparing/NodeComparator.php @@ -20,7 +20,7 @@ public function __construct( * Removes all comments from both nodes * @param Node|Node[]|null $node */ - public function printWithoutComments(Node | array | null $node): string + public function printWithoutComments(Node|array|null $node): string { $node = $this->commentRemover->removeFromNode($node); $content = $this->betterStandardPrinter->print($node); @@ -32,7 +32,7 @@ public function printWithoutComments(Node | array | null $node): string * @param Node|Node[]|null $firstNode * @param Node|Node[]|null $secondNode */ - public function areNodesEqual(Node | array | null $firstNode, Node | array | null $secondNode): bool + public function areNodesEqual(Node|array|null $firstNode, Node|array|null $secondNode): bool { if ($firstNode instanceof Node && ! $secondNode instanceof Node) { return false; diff --git a/src/PhpParser/Node/BetterNodeFinder.php b/src/PhpParser/Node/BetterNodeFinder.php index 5743cbf390c..413b0fd58fc 100644 --- a/src/PhpParser/Node/BetterNodeFinder.php +++ b/src/PhpParser/Node/BetterNodeFinder.php @@ -40,7 +40,7 @@ public function __construct( * @param Node|Node[]|Stmt[] $nodes * @return T[] */ - public function findInstancesOf(Node | array $nodes, array $types): array + public function findInstancesOf(Node|array $nodes, array $types): array { $foundInstances = []; foreach ($types as $type) { @@ -57,7 +57,7 @@ public function findInstancesOf(Node | array $nodes, array $types): array * @param Node|Node[]|Stmt[] $nodes * @return T[] */ - public function findInstanceOf(Node | array $nodes, string $type): array + public function findInstanceOf(Node|array $nodes, string $type): array { return $this->nodeFinder->findInstanceOf($nodes, $type); } @@ -69,7 +69,7 @@ public function findInstanceOf(Node | array $nodes, string $type): array * * @return T|null */ - public function findFirstInstanceOf(Node | array $nodes, string $type): ?Node + public function findFirstInstanceOf(Node|array $nodes, string $type): ?Node { Assert::isAOf($type, Node::class); return $this->nodeFinder->findFirstInstanceOf($nodes, $type); @@ -98,7 +98,7 @@ public function hasVariableOfName(array $nodes, string $name): bool * @param Node|Node[] $nodes * @return Variable|null */ - public function findVariableOfName(Node | array $nodes, string $name): ?Node + public function findVariableOfName(Node|array $nodes, string $name): ?Node { return $this->findInstanceOfName($nodes, Variable::class, $name); } @@ -107,7 +107,7 @@ public function findVariableOfName(Node | array $nodes, string $name): ?Node * @param Node|Node[] $nodes * @param array> $types */ - public function hasInstancesOf(Node | array $nodes, array $types): bool + public function hasInstancesOf(Node|array $nodes, array $types): bool { Assert::allIsAOf($types, Node::class); @@ -122,7 +122,7 @@ public function hasInstancesOf(Node | array $nodes, array $types): bool * @param callable(Node $node): bool $filter * @return Node[] */ - public function find(Node | array $nodes, callable $filter): array + public function find(Node|array $nodes, callable $filter): array { return $this->nodeFinder->find($nodes, $filter); } @@ -135,15 +135,14 @@ public function find(Node | array $nodes, callable $filter): array public function findFirstNonAnonymousClass(array $nodes): ?Node { // skip anonymous classes - return $this->findFirst($nodes, fn (Node $node): bool => - $node instanceof Class_ && ! $this->classAnalyzer->isAnonymousClass($node)); + return $this->findFirst($nodes, fn (Node $node): bool => $node instanceof Class_ && ! $this->classAnalyzer->isAnonymousClass($node)); } /** * @param Node|Node[] $nodes * @param callable(Node $filter): bool $filter */ - public function findFirst(Node | array $nodes, callable $filter): ?Node + public function findFirst(Node|array $nodes, callable $filter): ?Node { return $this->nodeFinder->findFirst($nodes, $filter); } @@ -295,11 +294,10 @@ function (Node $subNode) use (&$scopedNode, $filter): ?int { * @param Node|Node[] $nodes * @param class-string $type */ - private function findInstanceOfName(Node | array $nodes, string $type, string $name): ?Node + private function findInstanceOfName(Node|array $nodes, string $type, string $name): ?Node { Assert::isAOf($type, Node::class); - return $this->nodeFinder->findFirst($nodes, fn (Node $node): bool => - $node instanceof $type && $this->nodeNameResolver->isName($node, $name)); + return $this->nodeFinder->findFirst($nodes, fn (Node $node): bool => $node instanceof $type && $this->nodeNameResolver->isName($node, $name)); } } diff --git a/src/PhpParser/Node/NodeFactory.php b/src/PhpParser/Node/NodeFactory.php index 311ac81bac1..213894b865c 100644 --- a/src/PhpParser/Node/NodeFactory.php +++ b/src/PhpParser/Node/NodeFactory.php @@ -216,7 +216,7 @@ public function createMethodCall(Expr|string $exprOrVariableName, string $method return $this->builderFactory->methodCall($callerExpr, $method, $arguments); } - public function createPropertyFetch(string | Expr $variableNameOrExpr, string $property): PropertyFetch + public function createPropertyFetch(string|Expr $variableNameOrExpr, string $property): PropertyFetch { $fetcherExpr = is_string($variableNameOrExpr) ? new Variable($variableNameOrExpr) : $variableNameOrExpr; return $this->builderFactory->propertyFetch($fetcherExpr, $property); @@ -375,7 +375,7 @@ static function (Node $subNode): Node { return $node; } - private function createArrayItem(mixed $item, string | int | null $key = null): ArrayItem + private function createArrayItem(mixed $item, string|int|null $key = null): ArrayItem { $arrayItem = null; @@ -442,7 +442,7 @@ private function createArrayItem(mixed $item, string | int | null $key = null): return $arrayItem; } - private function decorateArrayItemWithKey(int | string | null $key, ArrayItem $arrayItem): void + private function decorateArrayItemWithKey(int|string|null $key, ArrayItem $arrayItem): void { if ($key === null) { return; diff --git a/src/PhpParser/NodeFinder/PropertyFetchFinder.php b/src/PhpParser/NodeFinder/PropertyFetchFinder.php index ee9fbbcf43c..e971ed72020 100644 --- a/src/PhpParser/NodeFinder/PropertyFetchFinder.php +++ b/src/PhpParser/NodeFinder/PropertyFetchFinder.php @@ -53,7 +53,7 @@ public function __construct( */ public function findPrivatePropertyFetches( Class_ $class, - Property | Param $propertyOrPromotedParam, + Property|Param $propertyOrPromotedParam, Scope $scope ): array { $propertyName = $this->resolvePropertyName($propertyOrPromotedParam); @@ -240,7 +240,7 @@ private function decoratePropertyFetch(Node $node, Scope $scope): void } } - private function isFoundByRefParam(MethodCall | StaticCall | FuncCall $node, int $key, Scope $scope): bool + private function isFoundByRefParam(MethodCall|StaticCall|FuncCall $node, int $key, Scope $scope): bool { $functionLikeReflection = $this->reflectionResolver->resolveFunctionLikeReflectionFromCall($node); if ($functionLikeReflection === null) { @@ -297,7 +297,7 @@ private function isNamePropertyNameEquals( return $propertyFetchVarTypeClassName === $classLikeName; } - private function resolvePropertyName(Property | Param $propertyOrPromotedParam): ?string + private function resolvePropertyName(Property|Param $propertyOrPromotedParam): ?string { if ($propertyOrPromotedParam instanceof Property) { return $this->nodeNameResolver->getName($propertyOrPromotedParam->props[0]); diff --git a/src/PhpParser/NodeVisitor/ClosureWithVariadicParametersNodeVisitor.php b/src/PhpParser/NodeVisitor/ClosureWithVariadicParametersNodeVisitor.php index 0d9cb1ca054..e87a3d46ac9 100644 --- a/src/PhpParser/NodeVisitor/ClosureWithVariadicParametersNodeVisitor.php +++ b/src/PhpParser/NodeVisitor/ClosureWithVariadicParametersNodeVisitor.php @@ -54,7 +54,7 @@ public function enterNode(Node $node): ?Node ); foreach ($parametersAcceptors->getParameters() as $extendedParameterReflection) { - if ($extendedParameterReflection->getType() instanceof CallableType && $extendedParameterReflection->getType() ->isVariadic()) { + if ($extendedParameterReflection->getType() instanceof CallableType && $extendedParameterReflection->getType()->isVariadic()) { $arg->value->setAttribute(AttributeKey::HAS_CLOSURE_WITH_VARIADIC_ARGS, true); } } diff --git a/src/PhpParser/Printer/BetterStandardPrinter.php b/src/PhpParser/Printer/BetterStandardPrinter.php index 9dac4166179..96067ef515f 100644 --- a/src/PhpParser/Printer/BetterStandardPrinter.php +++ b/src/PhpParser/Printer/BetterStandardPrinter.php @@ -81,7 +81,7 @@ public function printFormatPreserving(array $stmts, array $origStmts, array $ori /** * @param Node|Node[]|null $node */ - public function print(Node | array | null $node): string + public function print(Node|array|null $node): string { if ($node === null) { diff --git a/src/Rector/AbstractRector.php b/src/Rector/AbstractRector.php index 9988b66a6f2..db40c8f2140 100644 --- a/src/Rector/AbstractRector.php +++ b/src/Rector/AbstractRector.php @@ -266,7 +266,7 @@ protected function getNativeType(Expr $expr): Type * @param Node|Node[] $nodes * @param callable(Node): (int|Node|null|Node[]) $callable */ - protected function traverseNodesWithCallable(Node | array $nodes, callable $callable): void + protected function traverseNodesWithCallable(Node|array $nodes, callable $callable): void { $this->simpleCallableNodeTraverser->traverseNodesWithCallable($nodes, $callable); } @@ -311,7 +311,7 @@ private function postRefactorProcess( /** * @param Node[]|Node $node */ - private function refreshScopeNodes(array | Node $node, string $filePath, ?MutatingScope $mutatingScope): void + private function refreshScopeNodes(array|Node $node, string $filePath, ?MutatingScope $mutatingScope): void { $nodes = $node instanceof Node ? [$node] : $node; diff --git a/src/Reflection/ReflectionResolver.php b/src/Reflection/ReflectionResolver.php index 1e37c4072e2..d70e1a9dfbf 100644 --- a/src/Reflection/ReflectionResolver.php +++ b/src/Reflection/ReflectionResolver.php @@ -190,7 +190,7 @@ public function resolveMethodReflectionFromMethodCall(MethodCall $methodCall): ? public function resolveFunctionLikeReflectionFromCall( CallLike $callLike - ): MethodReflection | FunctionReflection | null { + ): MethodReflection|FunctionReflection|null { if ($callLike instanceof MethodCall) { return $this->resolveMethodReflectionFromMethodCall($callLike); } @@ -254,7 +254,7 @@ public function resolveConstructorReflectionFromAttribute(Attribute $attribute): } public function resolvePropertyReflectionFromPropertyFetch( - PropertyFetch | StaticPropertyFetch $propertyFetch + PropertyFetch|StaticPropertyFetch $propertyFetch ): ?PhpPropertyReflection { $propertyName = $this->nodeNameResolver->getName($propertyFetch->name); if ($propertyName === null) { @@ -285,7 +285,7 @@ public function resolvePropertyReflectionFromPropertyFetch( private function resolveFunctionReflectionFromFuncCall( FuncCall $funcCall - ): FunctionReflection | MethodReflection | null { + ): FunctionReflection|MethodReflection|null { if (! $funcCall->name instanceof Name) { return null; } diff --git a/src/Skipper/SkipVoter/ClassSkipVoter.php b/src/Skipper/SkipVoter/ClassSkipVoter.php index 4e0d4264d7c..1c3071cc385 100644 --- a/src/Skipper/SkipVoter/ClassSkipVoter.php +++ b/src/Skipper/SkipVoter/ClassSkipVoter.php @@ -18,7 +18,7 @@ public function __construct( ) { } - public function match(string | object $element): bool + public function match(string|object $element): bool { if (is_object($element)) { return true; @@ -27,7 +27,7 @@ public function match(string | object $element): bool return $this->reflectionProvider->hasClass($element); } - public function matchSkip(string | object $element, string $filePath): ?SkipMatch + public function matchSkip(string|object $element, string $filePath): ?SkipMatch { $skippedClasses = $this->skippedClassResolver->resolve(); return $this->skipSkipper->match($element, $filePath, $skippedClasses); diff --git a/src/Skipper/Skipper/SkipSkipper.php b/src/Skipper/Skipper/SkipSkipper.php index dab6e328ece..6df76ea3c8a 100644 --- a/src/Skipper/Skipper/SkipSkipper.php +++ b/src/Skipper/Skipper/SkipSkipper.php @@ -17,7 +17,7 @@ public function __construct( /** * @param array $skippedClasses */ - public function match(object | string $checker, string $filePath, array $skippedClasses): ?SkipMatch + public function match(object|string $checker, string $filePath, array $skippedClasses): ?SkipMatch { foreach ($skippedClasses as $skippedClass => $skippedFiles) { if (! is_a($checker, $skippedClass, true)) { diff --git a/src/Skipper/Skipper/Skipper.php b/src/Skipper/Skipper/Skipper.php index bf4fae8e428..fee095cd785 100644 --- a/src/Skipper/Skipper/Skipper.php +++ b/src/Skipper/Skipper/Skipper.php @@ -24,7 +24,7 @@ public function __construct( ) { } - public function shouldSkipElement(string | object $element): bool + public function shouldSkipElement(string|object $element): bool { return $this->shouldSkipElementAndFilePath($element, __FILE__); } @@ -34,7 +34,7 @@ public function shouldSkipFilePath(string $filePath): bool return $this->pathSkipper->shouldSkip($filePath); } - public function shouldSkipElementAndFilePath(string | object $element, string $filePath): bool + public function shouldSkipElementAndFilePath(string|object $element, string $filePath): bool { $skipMatch = $this->matchSkip($element, $filePath); if (! $skipMatch instanceof SkipMatch) { @@ -49,7 +49,7 @@ public function shouldSkipElementAndFilePath(string | object $element, string $f * Match a class/path skip without marking it used. Callers that can only tell whether the skip * actually prevented a change later on must mark it used themselves via markSkipUsed(). */ - public function matchSkip(string | object $element, string $filePath): ?SkipMatch + public function matchSkip(string|object $element, string $filePath): ?SkipMatch { if (! $this->classSkipVoter->match($element)) { return null; diff --git a/src/StaticTypeMapper/PhpDocParser/IdentifierPhpDocTypeMapper.php b/src/StaticTypeMapper/PhpDocParser/IdentifierPhpDocTypeMapper.php index 76a64dc7db9..1c7844f3a71 100644 --- a/src/StaticTypeMapper/PhpDocParser/IdentifierPhpDocTypeMapper.php +++ b/src/StaticTypeMapper/PhpDocParser/IdentifierPhpDocTypeMapper.php @@ -109,7 +109,7 @@ public function mapIdentifierTypeNode(IdentifierTypeNode $identifierTypeNode, No ); } - private function mapSelf(Node $node): MixedType | SelfObjectType + private function mapSelf(Node $node): MixedType|SelfObjectType { // @todo check FQN $className = $this->resolveClassName($node); @@ -121,7 +121,7 @@ private function mapSelf(Node $node): MixedType | SelfObjectType return new SelfObjectType($className); } - private function mapParent(Node $node): ParentStaticType | MixedType + private function mapParent(Node $node): ParentStaticType|MixedType { $className = $this->resolveClassName($node); if (! is_string($className)) { @@ -143,7 +143,7 @@ private function mapParent(Node $node): ParentStaticType | MixedType return new ParentStaticType($parentClassReflection); } - private function mapStatic(Node $node): MixedType | StaticType + private function mapStatic(Node $node): MixedType|StaticType { $className = $this->resolveClassName($node); if (! is_string($className)) { diff --git a/src/StaticTypeMapper/PhpParser/NameNodeMapper.php b/src/StaticTypeMapper/PhpParser/NameNodeMapper.php index 3d2e11c7aff..60ddd6be086 100644 --- a/src/StaticTypeMapper/PhpParser/NameNodeMapper.php +++ b/src/StaticTypeMapper/PhpParser/NameNodeMapper.php @@ -71,7 +71,7 @@ private function expandedNamespacedName(Name $name): ?FullyQualified private function createClassReferenceType( Name $name, string $reference - ): MixedType | StaticType | SelfStaticType | ObjectWithoutClassType { + ): MixedType|StaticType|SelfStaticType|ObjectWithoutClassType { $classReflection = $this->reflectionResolver->resolveClassReflection($name); if (! $classReflection instanceof ClassReflection) { return new MixedType(); diff --git a/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php b/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php index c9a14f997fe..2522c8cae13 100644 --- a/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php @@ -49,7 +49,7 @@ public function getShortName(): string return $this->getClassName(); } - public function areShortNamesEqual(self | FullyQualifiedObjectType $comparedObjectType): bool + public function areShortNamesEqual(self|FullyQualifiedObjectType $comparedObjectType): bool { return $this->getShortName() === $comparedObjectType->getShortName(); } diff --git a/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php b/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php index b917ce438de..4c3aee43bd6 100644 --- a/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php @@ -23,7 +23,7 @@ public function getShortNameType(): ShortenedObjectType return new ShortenedObjectType($this->getShortName(), $this->getClassName()); } - public function areShortNamesEqual(AliasedObjectType | self $comparedObjectType): bool + public function areShortNamesEqual(AliasedObjectType|self $comparedObjectType): bool { return $this->getShortName() === $comparedObjectType->getShortName(); } diff --git a/src/Util/FileHasher.php b/src/Util/FileHasher.php index a7aade2d4c2..f19d96a8011 100644 --- a/src/Util/FileHasher.php +++ b/src/Util/FileHasher.php @@ -42,7 +42,7 @@ public function hashFiles(array $files): string private function getAlgo(): string { - //see https://php.watch/articles/php-hash-benchmark + // see https://php.watch/articles/php-hash-benchmark if (\PHP_VERSION_ID >= 80100) { // if xxh128 is available use it, as it is way faster return 'xxh128'; diff --git a/src/ValueObject/Configuration.php b/src/ValueObject/Configuration.php index e1905416cac..0c1d516d875 100644 --- a/src/ValueObject/Configuration.php +++ b/src/ValueObject/Configuration.php @@ -25,8 +25,8 @@ public function __construct( private array $fileExtensions = ['php'], private array $paths = [], private bool $showDiffs = true, - private string | null $parallelPort = null, - private string | null $parallelIdentifier = null, + private string|null $parallelPort = null, + private string|null $parallelIdentifier = null, private bool $isParallel = false, private string|null $memoryLimit = null, private bool $isDebug = false, diff --git a/src/VendorLocker/NodeVendorLocker/ClassMethodReturnTypeOverrideGuard.php b/src/VendorLocker/NodeVendorLocker/ClassMethodReturnTypeOverrideGuard.php index cfe23c40b5d..6fe99ad0003 100644 --- a/src/VendorLocker/NodeVendorLocker/ClassMethodReturnTypeOverrideGuard.php +++ b/src/VendorLocker/NodeVendorLocker/ClassMethodReturnTypeOverrideGuard.php @@ -85,12 +85,10 @@ private function isReturnTypeChangeAllowed(ClassMethod $classMethod, Scope $scop return false; } - /* + /** * Below verify that both current file name and parent file name is not in the /vendor/, if yes, then allowed. * This can happen when rector run into /vendor/ directory while child and parent both are there. - * * @see https://3v4l.org/Rc0RF#v8.0.13 - * * - both in /vendor/ -> allowed * - one of them in /vendor/ -> not allowed * - both not in /vendor/ -> allowed diff --git a/src/functions/node_helper.php b/src/functions/node_helper.php index 0c0b58dba5e..ac4ac61782f 100644 --- a/src/functions/node_helper.php +++ b/src/functions/node_helper.php @@ -14,7 +14,7 @@ /** * @param Node|Node[] $node */ - function print_node(Node | array $node): void + function print_node(Node|array $node): void { $standard = new Standard(); diff --git a/tests/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/StaticDoctrineAnnotationParserTest.php b/tests/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/StaticDoctrineAnnotationParserTest.php index fd7c40b3f7c..d9d19c030fc 100644 --- a/tests/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/StaticDoctrineAnnotationParserTest.php +++ b/tests/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/StaticDoctrineAnnotationParserTest.php @@ -32,7 +32,7 @@ protected function setUp(): void * @param CurlyListNode|array $expectedValue */ #[DataProvider('provideData')] - public function test(string $docContent, CurlyListNode | array $expectedValue): void + public function test(string $docContent, CurlyListNode|array $expectedValue): void { $betterTokenIterator = $this->tokenIteratorFactory->create($docContent); diff --git a/tests/Issues/DynamicDocblockRename/config/configured_rule.php b/tests/Issues/DynamicDocblockRename/config/configured_rule.php index a132a15f1ae..8a02dd58fbb 100644 --- a/tests/Issues/DynamicDocblockRename/config/configured_rule.php +++ b/tests/Issues/DynamicDocblockRename/config/configured_rule.php @@ -11,8 +11,7 @@ $rectorConfig->ruleWithConfiguration( RenameClassRector::class, [ - 'Rector\Tests\CodeQuality\Rector\Class_\DynamicDocBlockPropertyToNativePropertyRector\Source\SomeDependency' - => 'stdClass', + 'Rector\Tests\CodeQuality\Rector\Class_\DynamicDocBlockPropertyToNativePropertyRector\Source\SomeDependency' => 'stdClass', ] ); }; diff --git a/tests/PhpParser/Node/Value/ValueResolverTest.php b/tests/PhpParser/Node/Value/ValueResolverTest.php index 7b7e72d6b7d..5d103ee830c 100644 --- a/tests/PhpParser/Node/Value/ValueResolverTest.php +++ b/tests/PhpParser/Node/Value/ValueResolverTest.php @@ -25,7 +25,7 @@ protected function setUp(): void } #[DataProvider('dataProvider')] - public function test(Expr $expr, string | bool | int | float | null $expectedValue): void + public function test(Expr $expr, string|bool|int|float|null $expectedValue): void { $resolvedValue = $this->valueResolver->getValue($expr); $this->assertSame($expectedValue, $resolvedValue); diff --git a/tests/StaticTypeMapper/PhpDoc/PhpDocTypeMapperTest.php b/tests/StaticTypeMapper/PhpDoc/PhpDocTypeMapperTest.php index bd7708d61ce..d0695af99a0 100644 --- a/tests/StaticTypeMapper/PhpDoc/PhpDocTypeMapperTest.php +++ b/tests/StaticTypeMapper/PhpDoc/PhpDocTypeMapperTest.php @@ -44,7 +44,7 @@ public function test(TypeNode $typeNode, string $expectedPHPStanType): void } /** - * @return Iterator<(class-string[] | ArrayShapeNode[])> + * @return Iterator<(class-string[]|ArrayShapeNode[])> */ public static function provideData(): Iterator { diff --git a/tests/Util/Reflection/PrivatesAccessorTest.php b/tests/Util/Reflection/PrivatesAccessorTest.php index 418fa7fbb04..acc073f451c 100644 --- a/tests/Util/Reflection/PrivatesAccessorTest.php +++ b/tests/Util/Reflection/PrivatesAccessorTest.php @@ -27,7 +27,7 @@ protected function setUp(): void */ #[DataProvider('provideData')] public function test( - string | SomeClassWithPrivateMethods $object, + string|SomeClassWithPrivateMethods $object, string $methodName, array $arguments, int $expectedResult