From 11534ad4687130b2855f5d2bd3fec381bb244bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Mon, 12 May 2025 21:05:23 +0000 Subject: [PATCH] Fix typos again --- docs/rector_rules_overview.md | 10 +++++----- .../ThrowWithPreviousExceptionRector.php | 14 +++++++------- ...cDocBlockPropertyToNativePropertyRector.php | 2 +- ...UseIdenticalOverEqualWithSameTypeRector.php | 4 ++-- .../Rector/Foreach_/ForeachToInArrayRector.php | 8 ++++---- .../AndAssignsToSeparateLinesRector.php | 2 +- ...ector.php => SimplifyQuoteEscapeRector.php} | 2 +- .../NodeAnalyzer/CallCollectionAnalyzer.php | 6 +++--- .../PhpDoc/DeadReturnTagValueNodeAnalyzer.php | 4 ++-- .../Rector/Assign/RemoveDoubleAssignRector.php | 2 +- .../Concat/RemoveConcatAutocastRector.php | 4 ++-- .../For_/RemoveDeadIfForeachForRector.php | 4 ++-- .../Guard/BreakingVariableRenameGuard.php | 10 +++++----- .../MatchPropertyTypeConflictingNameGuard.php | 2 +- .../Naming/Naming/ConflictingNameResolver.php | 4 ++-- ...php => OverriddenExistingNamesResolver.php} | 18 +++++++++--------- rules/Naming/PhpArray/ArrayFilter.php | 2 +- rules/Php70/EregToPcreTransformer.php | 2 +- rules/Php70/Rector/If_/IfToSpaceshipRector.php | 2 +- .../Class_/StringableForToStringRector.php | 2 +- ...r.php => CoalescePropertyAssignMatcher.php} | 2 +- .../ClassMethod/NewInInitializerRector.php | 8 ++++---- ...r.php => UninitializedPropertyAnalyzer.php} | 4 ++-- .../Empty_/DisallowedEmptyRuleFixerRector.php | 10 +++++----- .../BinaryOpNullableToInstanceofRector.php | 6 +++--- .../ReturnTypeFromStrictNewArrayRector.php | 2 +- ...ropertyTypeFromStrictSetterGetterRector.php | 2 +- .../IncreaseDeclareStrictTypesRector.php | 2 +- src/Application/FileProcessor.php | 2 +- .../Printer/RemoveNodesStartAndEndResolver.php | 2 +- src/Caching/Detector/ChangedFilesDetector.php | 10 +++++----- src/Config/Level/CodingStyleLevel.php | 2 +- src/Configuration/OnlyRuleResolver.php | 2 +- src/Configuration/Option.php | 2 +- src/Configuration/RectorConfigBuilder.php | 2 +- src/Console/Command/SetupCICommand.php | 2 +- .../Formatter/ColorConsoleDiffFormatter.php | 4 ++-- src/Console/Style/SymfonyStyleFactory.php | 2 +- ...hp => RectorRuleNameAmbiguousException.php} | 2 +- .../ClassRenamePhpDocNodeVisitor.php | 6 +++--- src/PhpDocParser/ValueObject/AttributeKey.php | 2 +- src/Util/ArrayParametersMerger.php | 2 +- src/Util/FileHasher.php | 4 ++-- 43 files changed, 93 insertions(+), 93 deletions(-) rename rules/CodingStyle/Rector/String_/{SymplifyQuoteEscapeRector.php => SimplifyQuoteEscapeRector.php} (98%) rename rules/Naming/Naming/{OverridenExistingNamesResolver.php => OverriddenExistingNamesResolver.php} (81%) rename rules/Php81/NodeAnalyzer/{CoalesePropertyAssignMatcher.php => CoalescePropertyAssignMatcher.php} (97%) rename rules/Strict/NodeAnalyzer/{UnitializedPropertyAnalyzer.php => UninitializedPropertyAnalyzer.php} (96%) rename src/Exception/Configuration/{RectorRuleNameAmbigiousException.php => RectorRuleNameAmbiguousException.php} (60%) diff --git a/docs/rector_rules_overview.md b/docs/rector_rules_overview.md index 71a923d14be9..9987ba6f6fb6 100644 --- a/docs/rector_rules_overview.md +++ b/docs/rector_rules_overview.md @@ -245,7 +245,7 @@ include/require to absolute path. This Rector might introduce backwards incompat ### AndAssignsToSeparateLinesRector -Split 2 assigns ands to separate line +Split 2 assigns and to separate line - class: [`Rector\CodeQuality\Rector\LogicalAnd\AndAssignsToSeparateLinesRector`](../rules/CodeQuality/Rector/LogicalAnd/AndAssignsToSeparateLinesRector.php) @@ -1598,9 +1598,9 @@ Use ===/!== over ==/!=, it values have the same type public function run(int $firstValue, int $secondValue) { - $isSame = $firstValue == $secondValue; -- $isDiffernt = $firstValue != $secondValue; +- $isDifferent = $firstValue != $secondValue; + $isSame = $firstValue === $secondValue; -+ $isDiffernt = $firstValue !== $secondValue; ++ $isDifferent = $firstValue !== $secondValue; } } ``` @@ -2083,7 +2083,7 @@ Makes array_search search for identical elements
-### SymplifyQuoteEscapeRector +### SimplifyQuoteEscapeRector Prefer quote that are not inside the string @@ -2279,7 +2279,7 @@ Remove (string) casting when it comes to concat, that does this by default - class: [`Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector`](../rules/DeadCode/Rector/Concat/RemoveConcatAutocastRector.php) ```diff - class SomeConcatingClass + class SomeConcatenatingClass { public function run($value) { diff --git a/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php b/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php index 5249dea72c7c..c05b81ca70f2 100644 --- a/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php +++ b/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php @@ -98,7 +98,7 @@ public function refactor(Node $node) : ?Node } return $node; } - private function refactorThrow(Throw_ $throw, Variable $catchedThrowableVariable) : ?int + private function refactorThrow(Throw_ $throw, Variable $caughtThrowableVariable) : ?int { if (!$throw->expr instanceof New_) { return null; @@ -123,23 +123,23 @@ private function refactorThrow(Throw_ $throw, Variable $catchedThrowableVariable $shouldUseNamedArguments = $messageArgument instanceof Arg && $messageArgument->name instanceof Identifier; if (!isset($new->args[0])) { // get previous message - $getMessageMethodCall = new MethodCall($catchedThrowableVariable, 'getMessage'); + $getMessageMethodCall = new MethodCall($caughtThrowableVariable, 'getMessage'); $new->args[0] = new Arg($getMessageMethodCall); - } elseif ($new->args[0] instanceof Arg && $new->args[0]->name instanceof Identifier && $new->args[0]->name->toString() === 'previous' && $this->nodeComparator->areNodesEqual($new->args[0]->value, $catchedThrowableVariable)) { + } elseif ($new->args[0] instanceof Arg && $new->args[0]->name instanceof Identifier && $new->args[0]->name->toString() === 'previous' && $this->nodeComparator->areNodesEqual($new->args[0]->value, $caughtThrowableVariable)) { $new->args[0]->name->name = 'message'; - $new->args[0]->value = new MethodCall($catchedThrowableVariable, 'getMessage'); + $new->args[0]->value = new MethodCall($caughtThrowableVariable, 'getMessage'); } if (!isset($new->getArgs()[1])) { // get previous code - $new->args[1] = new Arg(new MethodCall($catchedThrowableVariable, 'getCode'), \false, \false, [], $shouldUseNamedArguments ? new Identifier('code') : null); + $new->args[1] = new Arg(new MethodCall($caughtThrowableVariable, 'getCode'), \false, \false, [], $shouldUseNamedArguments ? new Identifier('code') : null); } /** @var Arg $arg1 */ $arg1 = $new->args[1]; if ($arg1->name instanceof Identifier && $arg1->name->toString() === 'previous') { - $new->args[1] = new Arg(new MethodCall($catchedThrowableVariable, 'getCode'), \false, \false, [], $shouldUseNamedArguments ? new Identifier('code') : null); + $new->args[1] = new Arg(new MethodCall($caughtThrowableVariable, 'getCode'), \false, \false, [], $shouldUseNamedArguments ? new Identifier('code') : null); $new->args[$exceptionArgumentPosition] = $arg1; } else { - $new->args[$exceptionArgumentPosition] = new Arg($catchedThrowableVariable, \false, \false, [], $shouldUseNamedArguments ? new Identifier('previous') : null); + $new->args[$exceptionArgumentPosition] = new Arg($caughtThrowableVariable, \false, \false, [], $shouldUseNamedArguments ? new Identifier('previous') : null); } // null the node, to fix broken format preserving printers, see https://github.com/rectorphp/rector/issues/5576 $new->setAttribute(AttributeKey::ORIGINAL_NODE, null); diff --git a/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php b/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php index 7d481871dd5c..daf67aa0598b 100644 --- a/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php +++ b/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php @@ -167,7 +167,7 @@ private function createNewPropertyFromPropertyTagValueNodes(array $propertyPhpDo } // is property already defined? if ($class->getProperty($propertyName) instanceof Property) { - // improve exising one type if needed + // improve existing one type if needed $existingProperty = $class->getProperty($propertyName); if ($existingProperty->type instanceof Node) { continue; diff --git a/rules/CodeQuality/Rector/Equal/UseIdenticalOverEqualWithSameTypeRector.php b/rules/CodeQuality/Rector/Equal/UseIdenticalOverEqualWithSameTypeRector.php index 85b6a1eb8829..0f0c5ba8c485 100644 --- a/rules/CodeQuality/Rector/Equal/UseIdenticalOverEqualWithSameTypeRector.php +++ b/rules/CodeQuality/Rector/Equal/UseIdenticalOverEqualWithSameTypeRector.php @@ -26,7 +26,7 @@ class SomeClass public function run(int $firstValue, int $secondValue) { $isSame = $firstValue == $secondValue; - $isDiffernt = $firstValue != $secondValue; + $isDifferent = $firstValue != $secondValue; } } CODE_SAMPLE @@ -36,7 +36,7 @@ class SomeClass public function run(int $firstValue, int $secondValue) { $isSame = $firstValue === $secondValue; - $isDiffernt = $firstValue !== $secondValue; + $isDifferent = $firstValue !== $secondValue; } } CODE_SAMPLE diff --git a/rules/CodeQuality/Rector/Foreach_/ForeachToInArrayRector.php b/rules/CodeQuality/Rector/Foreach_/ForeachToInArrayRector.php index 56e745d2b96d..cc1b238c6aae 100644 --- a/rules/CodeQuality/Rector/Foreach_/ForeachToInArrayRector.php +++ b/rules/CodeQuality/Rector/Foreach_/ForeachToInArrayRector.php @@ -166,14 +166,14 @@ private function matchNodes($binaryOp, Expr $expr) : ?TwoNodeMatch } private function isIfBodyABoolReturnNode(If_ $if) : bool { - $ifStatment = $if->stmts[0]; - if (!$ifStatment instanceof Return_) { + $ifStatement = $if->stmts[0]; + if (!$ifStatement instanceof Return_) { return \false; } - if (!$ifStatment->expr instanceof Expr) { + if (!$ifStatement->expr instanceof Expr) { return \false; } - return $this->valueResolver->isTrueOrFalse($ifStatment->expr); + return $this->valueResolver->isTrueOrFalse($ifStatement->expr); } /** * @param \PhpParser\Node\Expr\BinaryOp\Identical|\PhpParser\Node\Expr\BinaryOp\Equal $binaryOp diff --git a/rules/CodeQuality/Rector/LogicalAnd/AndAssignsToSeparateLinesRector.php b/rules/CodeQuality/Rector/LogicalAnd/AndAssignsToSeparateLinesRector.php index 33753fea34a7..27c3ea645f1d 100644 --- a/rules/CodeQuality/Rector/LogicalAnd/AndAssignsToSeparateLinesRector.php +++ b/rules/CodeQuality/Rector/LogicalAnd/AndAssignsToSeparateLinesRector.php @@ -17,7 +17,7 @@ final class AndAssignsToSeparateLinesRector extends AbstractRector { public function getRuleDefinition() : RuleDefinition { - return new RuleDefinition('Split 2 assigns ands to separate line', [new CodeSample(<<<'CODE_SAMPLE' + return new RuleDefinition('Split 2 assigns and to separate line', [new CodeSample(<<<'CODE_SAMPLE' class SomeClass { public function run() diff --git a/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php b/rules/CodingStyle/Rector/String_/SimplifyQuoteEscapeRector.php similarity index 98% rename from rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php rename to rules/CodingStyle/Rector/String_/SimplifyQuoteEscapeRector.php index 7e9058305a2d..aaafc4e2e9f6 100644 --- a/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php +++ b/rules/CodingStyle/Rector/String_/SimplifyQuoteEscapeRector.php @@ -13,7 +13,7 @@ /** * @see \Rector\Tests\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector\SymplifyQuoteEscapeRectorTest */ -final class SymplifyQuoteEscapeRector extends AbstractRector +final class SimplifyQuoteEscapeRector extends AbstractRector { /** * @var string diff --git a/rules/DeadCode/NodeAnalyzer/CallCollectionAnalyzer.php b/rules/DeadCode/NodeAnalyzer/CallCollectionAnalyzer.php index 042db870fffe..da1e520e1c8a 100644 --- a/rules/DeadCode/NodeAnalyzer/CallCollectionAnalyzer.php +++ b/rules/DeadCode/NodeAnalyzer/CallCollectionAnalyzer.php @@ -37,8 +37,8 @@ public function isExists(array $calls, string $classMethodName, string $classNam foreach ($calls as $call) { $callerRoot = $call instanceof StaticCall ? $call->class : $call->var; $callerType = $this->nodeTypeResolver->getType($callerRoot); - $callerTypeClasName = ClassNameFromObjectTypeResolver::resolve($callerType); - if ($callerTypeClasName === null) { + $callerTypeClassName = ClassNameFromObjectTypeResolver::resolve($callerType); + if ($callerTypeClassName === null) { // handle fluent by $this->bar()->baz()->qux() // that methods don't have return type if ($callerType instanceof MixedType && !$callerType->isExplicitMixed()) { @@ -65,7 +65,7 @@ public function isExists(array $calls, string $classMethodName, string $classNam if ($this->isSelfStatic($call) && $this->shouldSkip($call, $classMethodName)) { return \true; } - if ($callerTypeClasName !== $className) { + if ($callerTypeClassName !== $className) { continue; } if ($this->shouldSkip($call, $classMethodName)) { diff --git a/rules/DeadCode/PhpDoc/DeadReturnTagValueNodeAnalyzer.php b/rules/DeadCode/PhpDoc/DeadReturnTagValueNodeAnalyzer.php index d3aa7ef38dcf..50b66e794c02 100644 --- a/rules/DeadCode/PhpDoc/DeadReturnTagValueNodeAnalyzer.php +++ b/rules/DeadCode/PhpDoc/DeadReturnTagValueNodeAnalyzer.php @@ -115,7 +115,7 @@ private function isDeadNotEqual(ReturnTagValueNode $returnTagValueNode, Node $no if ($returnTagValueNode->type instanceof IdentifierTypeNode && (string) $returnTagValueNode->type === 'void') { return \true; } - if (!$this->hasUsefullPhpdocType($returnTagValueNode, $node)) { + if (!$this->hasUsefulPhpdocType($returnTagValueNode, $node)) { return \true; } $nodeType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($node); @@ -140,7 +140,7 @@ private function hasTrueFalsePseudoType(BracketsAwareUnionTypeNode $bracketsAwar * exact different between @return and node return type * @param mixed $returnType */ - private function hasUsefullPhpdocType(ReturnTagValueNode $returnTagValueNode, $returnType) : bool + private function hasUsefulPhpdocType(ReturnTagValueNode $returnTagValueNode, $returnType) : bool { if ($returnTagValueNode->type instanceof IdentifierTypeNode && $returnTagValueNode->type->name === 'mixed') { return \false; diff --git a/rules/DeadCode/Rector/Assign/RemoveDoubleAssignRector.php b/rules/DeadCode/Rector/Assign/RemoveDoubleAssignRector.php index 5437de4ba0bc..e890e1c03e25 100644 --- a/rules/DeadCode/Rector/Assign/RemoveDoubleAssignRector.php +++ b/rules/DeadCode/Rector/Assign/RemoveDoubleAssignRector.php @@ -95,7 +95,7 @@ public function refactor(Node $node) : ?Node if (!$stmt->expr->var instanceof Variable && !$stmt->expr->var instanceof PropertyFetch && !$stmt->expr->var instanceof StaticPropertyFetch) { continue; } - // remove current Stmt if will be overriden in next stmt + // remove current Stmt if will be overridden in next stmt unset($node->stmts[$key]); $hasChanged = \true; } diff --git a/rules/DeadCode/Rector/Concat/RemoveConcatAutocastRector.php b/rules/DeadCode/Rector/Concat/RemoveConcatAutocastRector.php index 5a62f08b2989..6eb29ee7281d 100644 --- a/rules/DeadCode/Rector/Concat/RemoveConcatAutocastRector.php +++ b/rules/DeadCode/Rector/Concat/RemoveConcatAutocastRector.php @@ -18,7 +18,7 @@ final class RemoveConcatAutocastRector extends AbstractRector public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Remove (string) casting when it comes to concat, that does this by default', [new CodeSample(<<<'CODE_SAMPLE' -class SomeConcatingClass +class SomeConcatenatingClass { public function run($value) { @@ -27,7 +27,7 @@ public function run($value) } CODE_SAMPLE , <<<'CODE_SAMPLE' -class SomeConcatingClass +class SomeConcatenatingClass { public function run($value) { diff --git a/rules/DeadCode/Rector/For_/RemoveDeadIfForeachForRector.php b/rules/DeadCode/Rector/For_/RemoveDeadIfForeachForRector.php index be5edf33f5d0..0550732d1af7 100644 --- a/rules/DeadCode/Rector/For_/RemoveDeadIfForeachForRector.php +++ b/rules/DeadCode/Rector/For_/RemoveDeadIfForeachForRector.php @@ -48,7 +48,7 @@ public function getRuleDefinition() : RuleDefinition return new RuleDefinition('Remove if, foreach and for that does not do anything', [new CodeSample(<<<'CODE_SAMPLE' class SomeClass { - public function run($value, $differrentValue) + public function run($value, $differentValue) { if ($value) { } @@ -63,7 +63,7 @@ public function run($value, $differrentValue) , <<<'CODE_SAMPLE' class SomeClass { - public function run($value, $differrentValue) + public function run($value, $differentValue) { return $differentValue; } diff --git a/rules/Naming/Guard/BreakingVariableRenameGuard.php b/rules/Naming/Guard/BreakingVariableRenameGuard.php index f9102fa3ed71..96f713c75251 100644 --- a/rules/Naming/Guard/BreakingVariableRenameGuard.php +++ b/rules/Naming/Guard/BreakingVariableRenameGuard.php @@ -43,7 +43,7 @@ final class BreakingVariableRenameGuard /** * @readonly */ - private OverridenExistingNamesResolver $overridenExistingNamesResolver; + private OverriddenExistingNamesResolver $overriddenExistingNamesResolver; /** * @readonly */ @@ -57,12 +57,12 @@ final class BreakingVariableRenameGuard * @see https://regex101.com/r/1pKLgf/1 */ public const AT_NAMING_REGEX = '#[\\w+]At$#'; - public function __construct(BetterNodeFinder $betterNodeFinder, ConflictingNameResolver $conflictingNameResolver, NodeTypeResolver $nodeTypeResolver, OverridenExistingNamesResolver $overridenExistingNamesResolver, TypeUnwrapper $typeUnwrapper, NodeNameResolver $nodeNameResolver) + public function __construct(BetterNodeFinder $betterNodeFinder, ConflictingNameResolver $conflictingNameResolver, NodeTypeResolver $nodeTypeResolver, OverriddenExistingNamesResolver $overriddenExistingNamesResolver, TypeUnwrapper $typeUnwrapper, NodeNameResolver $nodeNameResolver) { $this->betterNodeFinder = $betterNodeFinder; $this->conflictingNameResolver = $conflictingNameResolver; $this->nodeTypeResolver = $nodeTypeResolver; - $this->overridenExistingNamesResolver = $overridenExistingNamesResolver; + $this->overriddenExistingNamesResolver = $overriddenExistingNamesResolver; $this->typeUnwrapper = $typeUnwrapper; $this->nodeNameResolver = $nodeNameResolver; } @@ -79,7 +79,7 @@ public function shouldSkipVariable(string $currentName, string $expectedName, $f if ($this->conflictingNameResolver->hasNameIsInFunctionLike($expectedName, $functionLike)) { return \true; } - if (!$functionLike instanceof ArrowFunction && $this->overridenExistingNamesResolver->hasNameInClassMethodForNew($currentName, $functionLike)) { + if (!$functionLike instanceof ArrowFunction && $this->overriddenExistingNamesResolver->hasNameInClassMethodForNew($currentName, $functionLike)) { return \true; } if ($this->isVariableAlreadyDefined($variable, $currentName)) { @@ -107,7 +107,7 @@ public function shouldSkipParam(string $currentName, string $expectedName, $clas if ($this->conflictingNameResolver->hasNameIsInFunctionLike($expectedName, $classMethod)) { return \true; } - if ($this->overridenExistingNamesResolver->hasNameInFunctionLikeForParam($expectedName, $classMethod)) { + if ($this->overriddenExistingNamesResolver->hasNameInFunctionLikeForParam($expectedName, $classMethod)) { return \true; } if ($param->var instanceof Error) { diff --git a/rules/Naming/Guard/PropertyConflictingNameGuard/MatchPropertyTypeConflictingNameGuard.php b/rules/Naming/Guard/PropertyConflictingNameGuard/MatchPropertyTypeConflictingNameGuard.php index d168b4ec6d98..4da8614b8bad 100644 --- a/rules/Naming/Guard/PropertyConflictingNameGuard/MatchPropertyTypeConflictingNameGuard.php +++ b/rules/Naming/Guard/PropertyConflictingNameGuard/MatchPropertyTypeConflictingNameGuard.php @@ -47,6 +47,6 @@ private function resolve(ClassLike $classLike) : array } $expectedNames[] = $expectedName; } - return $this->arrayFilter->filterWithAtLeastTwoOccurences($expectedNames); + return $this->arrayFilter->filterWithAtLeastTwoOccurrences($expectedNames); } } diff --git a/rules/Naming/Naming/ConflictingNameResolver.php b/rules/Naming/Naming/ConflictingNameResolver.php index d7a777f50761..9972ceb9d79d 100644 --- a/rules/Naming/Naming/ConflictingNameResolver.php +++ b/rules/Naming/Naming/ConflictingNameResolver.php @@ -60,7 +60,7 @@ public function resolveConflictingVariableNamesForParam($classMethod) : array } $expectedNames[] = $expectedName; } - return $this->arrayFilter->filterWithAtLeastTwoOccurences($expectedNames); + return $this->arrayFilter->filterWithAtLeastTwoOccurrences($expectedNames); } /** * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $functionLike @@ -85,7 +85,7 @@ private function resolveConflictingVariableNamesForNew($functionLike) : array $newAssignNames = $this->resolveForNewAssigns($functionLike); $nonNewAssignNames = $this->resolveForNonNewAssigns($functionLike); $protectedNames = \array_merge($paramNames, $newAssignNames, $nonNewAssignNames); - $protectedNames = $this->arrayFilter->filterWithAtLeastTwoOccurences($protectedNames); + $protectedNames = $this->arrayFilter->filterWithAtLeastTwoOccurrences($protectedNames); $this->conflictingVariableNamesByClassMethod[$classMethodId] = $protectedNames; return $protectedNames; } diff --git a/rules/Naming/Naming/OverridenExistingNamesResolver.php b/rules/Naming/Naming/OverriddenExistingNamesResolver.php similarity index 81% rename from rules/Naming/Naming/OverridenExistingNamesResolver.php rename to rules/Naming/Naming/OverriddenExistingNamesResolver.php index 1cdf69ab9fd8..96d4d3d89b1c 100644 --- a/rules/Naming/Naming/OverridenExistingNamesResolver.php +++ b/rules/Naming/Naming/OverriddenExistingNamesResolver.php @@ -12,7 +12,7 @@ use Rector\Naming\PhpArray\ArrayFilter; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpParser\Node\BetterNodeFinder; -final class OverridenExistingNamesResolver +final class OverriddenExistingNamesResolver { /** * @readonly @@ -29,7 +29,7 @@ final class OverridenExistingNamesResolver /** * @var array> */ - private array $overridenExistingVariableNamesByClassMethod = []; + private array $overriddenExistingVariableNamesByClassMethod = []; public function __construct(ArrayFilter $arrayFilter, BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver) { $this->arrayFilter = $arrayFilter; @@ -41,8 +41,8 @@ public function __construct(ArrayFilter $arrayFilter, BetterNodeFinder $betterNo */ public function hasNameInClassMethodForNew(string $variableName, $functionLike) : bool { - $overridenVariableNames = $this->resolveOveriddenNamesForNew($functionLike); - return \in_array($variableName, $overridenVariableNames, \true); + $overriddenVariableNames = $this->resolveOverriddenNamesForNew($functionLike); + return \in_array($variableName, $overriddenVariableNames, \true); } /** * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $classMethod @@ -68,11 +68,11 @@ public function hasNameInFunctionLikeForParam(string $expectedName, $classMethod * @return string[] * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure $functionLike */ - private function resolveOveriddenNamesForNew($functionLike) : array + private function resolveOverriddenNamesForNew($functionLike) : array { $classMethodId = \spl_object_id($functionLike); - if (isset($this->overridenExistingVariableNamesByClassMethod[$classMethodId])) { - return $this->overridenExistingVariableNamesByClassMethod[$classMethodId]; + if (isset($this->overriddenExistingVariableNamesByClassMethod[$classMethodId])) { + return $this->overriddenExistingVariableNamesByClassMethod[$classMethodId]; } $currentlyUsedNames = []; /** @var Assign[] $assigns */ @@ -86,8 +86,8 @@ private function resolveOveriddenNamesForNew($functionLike) : array } $currentlyUsedNames[] = $currentVariableName; } - $currentlyUsedNames = $this->arrayFilter->filterWithAtLeastTwoOccurences($currentlyUsedNames); - $this->overridenExistingVariableNamesByClassMethod[$classMethodId] = $currentlyUsedNames; + $currentlyUsedNames = $this->arrayFilter->filterWithAtLeastTwoOccurrences($currentlyUsedNames); + $this->overriddenExistingVariableNamesByClassMethod[$classMethodId] = $currentlyUsedNames; return $currentlyUsedNames; } } diff --git a/rules/Naming/PhpArray/ArrayFilter.php b/rules/Naming/PhpArray/ArrayFilter.php index aa08433e93ea..a34d95edef2d 100644 --- a/rules/Naming/PhpArray/ArrayFilter.php +++ b/rules/Naming/PhpArray/ArrayFilter.php @@ -9,7 +9,7 @@ final class ArrayFilter * @param mixed[] $values * @return string[] */ - public function filterWithAtLeastTwoOccurences(array $values) : array + public function filterWithAtLeastTwoOccurrences(array $values) : array { /** @var array $valueToCount */ $valueToCount = \array_count_values($values); diff --git a/rules/Php70/EregToPcreTransformer.php b/rules/Php70/EregToPcreTransformer.php index 39614301545b..f8d0ac239d76 100644 --- a/rules/Php70/EregToPcreTransformer.php +++ b/rules/Php70/EregToPcreTransformer.php @@ -59,7 +59,7 @@ final class EregToPcreTransformer */ private array $cache = []; /** - * Change this via services configuratoin in rector.php if you need it + * Change this via services configuration in rector.php if you need it * Single type is chosen to prevent every regular with different delimiter. */ public function __construct(string $pcreDelimiter = '#') diff --git a/rules/Php70/Rector/If_/IfToSpaceshipRector.php b/rules/Php70/Rector/If_/IfToSpaceshipRector.php index 45ed69cb76fb..c39c50b98002 100644 --- a/rules/Php70/Rector/If_/IfToSpaceshipRector.php +++ b/rules/Php70/Rector/If_/IfToSpaceshipRector.php @@ -83,7 +83,7 @@ public function refactor(Node $node) : ?Node if (!$stmt->expr instanceof Ternary) { continue; } - // preceeded by if + // preceded by if $prevStmt = $node->stmts[$key - 1] ?? null; if (!$prevStmt instanceof If_) { continue; diff --git a/rules/Php80/Rector/Class_/StringableForToStringRector.php b/rules/Php80/Rector/Class_/StringableForToStringRector.php index c4122052e310..66a70b329f29 100644 --- a/rules/Php80/Rector/Class_/StringableForToStringRector.php +++ b/rules/Php80/Rector/Class_/StringableForToStringRector.php @@ -104,7 +104,7 @@ public function refactor(Node $node) : ?Node return null; } $this->hasChanged = \false; - // warning, classes that implements __toString() will return Stringable interface even if they don't implemen it + // warning, classes that implements __toString() will return Stringable interface even if they don't implement it // reflection cannot be used for real detection $classLikeAncestorNames = $this->familyRelationsAnalyzer->getClassLikeAncestorNames($node); $isAncestorHasStringable = \in_array(self::STRINGABLE, $classLikeAncestorNames, \true); diff --git a/rules/Php81/NodeAnalyzer/CoalesePropertyAssignMatcher.php b/rules/Php81/NodeAnalyzer/CoalescePropertyAssignMatcher.php similarity index 97% rename from rules/Php81/NodeAnalyzer/CoalesePropertyAssignMatcher.php rename to rules/Php81/NodeAnalyzer/CoalescePropertyAssignMatcher.php index dc473ec88d7e..2a5b4f4707ce 100644 --- a/rules/Php81/NodeAnalyzer/CoalesePropertyAssignMatcher.php +++ b/rules/Php81/NodeAnalyzer/CoalescePropertyAssignMatcher.php @@ -11,7 +11,7 @@ use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; use Rector\NodeNameResolver\NodeNameResolver; -final class CoalesePropertyAssignMatcher +final class CoalescePropertyAssignMatcher { /** * @readonly diff --git a/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php b/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php index 1dbd714d1800..0e7cb1fcddbf 100644 --- a/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php +++ b/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php @@ -38,16 +38,16 @@ final class NewInInitializerRector extends AbstractRector implements MinPhpVersi /** * @readonly */ - private CoalesePropertyAssignMatcher $coalesePropertyAssignMatcher; + private CoalescePropertyAssignMatcher $coalescePropertyAssignMatcher; /** * @readonly */ private StmtsManipulator $stmtsManipulator; - public function __construct(ReflectionResolver $reflectionResolver, ClassChildAnalyzer $classChildAnalyzer, CoalesePropertyAssignMatcher $coalesePropertyAssignMatcher, StmtsManipulator $stmtsManipulator) + public function __construct(ReflectionResolver $reflectionResolver, ClassChildAnalyzer $classChildAnalyzer, CoalescePropertyAssignMatcher $coalescePropertyAssignMatcher, StmtsManipulator $stmtsManipulator) { $this->reflectionResolver = $reflectionResolver; $this->classChildAnalyzer = $classChildAnalyzer; - $this->coalesePropertyAssignMatcher = $coalesePropertyAssignMatcher; + $this->coalescePropertyAssignMatcher = $coalescePropertyAssignMatcher; $this->stmtsManipulator = $stmtsManipulator; } public function getRuleDefinition() : RuleDefinition @@ -105,7 +105,7 @@ public function refactor(Node $node) : ?Node foreach ((array) $constructClassMethod->stmts as $key => $stmt) { foreach ($params as $param) { $paramName = $this->getName($param); - $coalesce = $this->coalesePropertyAssignMatcher->matchCoalesceAssignsToLocalPropertyNamed($stmt, $paramName); + $coalesce = $this->coalescePropertyAssignMatcher->matchCoalesceAssignsToLocalPropertyNamed($stmt, $paramName); if (!$coalesce instanceof Coalesce) { continue; } diff --git a/rules/Strict/NodeAnalyzer/UnitializedPropertyAnalyzer.php b/rules/Strict/NodeAnalyzer/UninitializedPropertyAnalyzer.php similarity index 96% rename from rules/Strict/NodeAnalyzer/UnitializedPropertyAnalyzer.php rename to rules/Strict/NodeAnalyzer/UninitializedPropertyAnalyzer.php index b7aa777c4d4f..4e4e106bcffd 100644 --- a/rules/Strict/NodeAnalyzer/UnitializedPropertyAnalyzer.php +++ b/rules/Strict/NodeAnalyzer/UninitializedPropertyAnalyzer.php @@ -14,7 +14,7 @@ use Rector\PhpParser\AstResolver; use Rector\StaticTypeMapper\Resolver\ClassNameFromObjectTypeResolver; use Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector; -final class UnitializedPropertyAnalyzer +final class UninitializedPropertyAnalyzer { /** * @readonly @@ -39,7 +39,7 @@ public function __construct(AstResolver $astResolver, NodeTypeResolver $nodeType $this->constructorAssignDetector = $constructorAssignDetector; $this->nodeNameResolver = $nodeNameResolver; } - public function isUnitialized(Expr $expr) : bool + public function isUninitialized(Expr $expr) : bool { if (!$expr instanceof PropertyFetch && !$expr instanceof StaticPropertyFetch) { return \false; diff --git a/rules/Strict/Rector/Empty_/DisallowedEmptyRuleFixerRector.php b/rules/Strict/Rector/Empty_/DisallowedEmptyRuleFixerRector.php index abb8066bf57b..2ae7bad6fbd2 100644 --- a/rules/Strict/Rector/Empty_/DisallowedEmptyRuleFixerRector.php +++ b/rules/Strict/Rector/Empty_/DisallowedEmptyRuleFixerRector.php @@ -36,12 +36,12 @@ final class DisallowedEmptyRuleFixerRector extends AbstractFalsyScalarRuleFixerR /** * @readonly */ - private UnitializedPropertyAnalyzer $unitializedPropertyAnalyzer; - public function __construct(ExactCompareFactory $exactCompareFactory, ExprAnalyzer $exprAnalyzer, UnitializedPropertyAnalyzer $unitializedPropertyAnalyzer) + private UninitializedPropertyAnalyzer $uninitializedPropertyAnalyzer; + public function __construct(ExactCompareFactory $exactCompareFactory, ExprAnalyzer $exprAnalyzer, UninitializedPropertyAnalyzer $uninitializedPropertyAnalyzer) { $this->exactCompareFactory = $exactCompareFactory; $this->exprAnalyzer = $exprAnalyzer; - $this->unitializedPropertyAnalyzer = $unitializedPropertyAnalyzer; + $this->uninitializedPropertyAnalyzer = $uninitializedPropertyAnalyzer; } public function getRuleDefinition() : RuleDefinition { @@ -104,7 +104,7 @@ private function refactorBooleanNot(BooleanNot $booleanNot, Scope $scope) : ?\Ph if (!$result instanceof Expr) { return null; } - if ($this->unitializedPropertyAnalyzer->isUnitialized($empty->expr)) { + if ($this->uninitializedPropertyAnalyzer->isUninitialized($empty->expr)) { return new BooleanAnd(new Isset_([$empty->expr]), $result); } return $result; @@ -119,7 +119,7 @@ private function refactorEmpty(Empty_ $empty, Scope $scope, bool $treatAsNonEmpt if (!$result instanceof Expr) { return null; } - if ($this->unitializedPropertyAnalyzer->isUnitialized($empty->expr)) { + if ($this->uninitializedPropertyAnalyzer->isUninitialized($empty->expr)) { return new BooleanOr(new BooleanNot(new Isset_([$empty->expr])), $result); } return $result; diff --git a/rules/TypeDeclaration/Rector/BooleanAnd/BinaryOpNullableToInstanceofRector.php b/rules/TypeDeclaration/Rector/BooleanAnd/BinaryOpNullableToInstanceofRector.php index 6e124746ff83..a20a43dfd56a 100644 --- a/rules/TypeDeclaration/Rector/BooleanAnd/BinaryOpNullableToInstanceofRector.php +++ b/rules/TypeDeclaration/Rector/BooleanAnd/BinaryOpNullableToInstanceofRector.php @@ -71,13 +71,13 @@ public function refactor(Node $node) : ?Node if ($node instanceof BooleanOr) { return $this->processNegationBooleanOr($node); } - return $this->processsNullableInstance($node); + return $this->processNullableInstance($node); } /** * @param \PhpParser\Node\Expr\BinaryOp\BooleanAnd|\PhpParser\Node\Expr\BinaryOp\BooleanOr $node * @return null|\PhpParser\Node\Expr\BinaryOp\BooleanAnd|\PhpParser\Node\Expr\BinaryOp\BooleanOr */ - private function processsNullableInstance($node) + private function processNullableInstance($node) { $nullableObjectType = $this->nullableTypeAnalyzer->resolveNullableObjectType($node->left); $hasChanged = \false; @@ -116,7 +116,7 @@ private function processNegationBooleanOr(BooleanOr $booleanOr) : ?BooleanOr return $booleanOr; } /** @var BooleanOr|null $result */ - $result = $this->processsNullableInstance($booleanOr); + $result = $this->processNullableInstance($booleanOr); return $result; } private function createExprInstanceof(Expr $expr, ObjectType $objectType) : Instanceof_ diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php index 08d8b125a35a..f7a427c15fa8 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php @@ -208,7 +208,7 @@ private function changeReturnType($node, Type $arrayType) : void */ private function matchVariableNotOverriddenByNonArray($functionLike, array $variables) : array { - // is variable overriden? + // is variable overridden? /** @var Assign[] $assigns */ $assigns = $this->betterNodeFinder->findInstancesOfInFunctionLikeScoped($functionLike, Assign::class); foreach ($assigns as $assign) { diff --git a/rules/TypeDeclaration/Rector/Class_/PropertyTypeFromStrictSetterGetterRector.php b/rules/TypeDeclaration/Rector/Class_/PropertyTypeFromStrictSetterGetterRector.php index aaa1f32d59ae..7833f0ca1289 100644 --- a/rules/TypeDeclaration/Rector/Class_/PropertyTypeFromStrictSetterGetterRector.php +++ b/rules/TypeDeclaration/Rector/Class_/PropertyTypeFromStrictSetterGetterRector.php @@ -189,7 +189,7 @@ private function decorateDefaultExpr(Type $getterSetterPropertyType, Property $p { if (!TypeCombinator::containsNull($getterSetterPropertyType)) { if ($hasPropertyDefaultNull) { - // reset to nothign + // reset to nothing $property->props[0]->default = null; } return; diff --git a/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php b/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php index 427717321255..e59556f3b6b6 100644 --- a/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php +++ b/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php @@ -70,7 +70,7 @@ public function beforeTraverse(array $nodes) : ?array if ($this->declareStrictTypeFinder->hasDeclareStrictTypes($stmt)) { return null; } - // keep change withing a limit + // keep change within a limit if ($this->changedItemCount >= $this->limit) { return null; } diff --git a/src/Application/FileProcessor.php b/src/Application/FileProcessor.php index f6c5542bc7f9..d9b3fa0cc414 100644 --- a/src/Application/FileProcessor.php +++ b/src/Application/FileProcessor.php @@ -108,7 +108,7 @@ public function processFile(File $file, Configuration $configuration) : FileProc } while (\true); // 5. add as cacheable if not changed at all if (!$fileHasChanged) { - $this->changedFilesDetector->addCachableFile($filePath); + $this->changedFilesDetector->addCacheableFile($filePath); } else { // when changed, set final status changed to true // to ensure it make sense to verify in next process when needed diff --git a/src/BetterPhpDocParser/Printer/RemoveNodesStartAndEndResolver.php b/src/BetterPhpDocParser/Printer/RemoveNodesStartAndEndResolver.php index ffd5c26e23e7..85a1027a3c4f 100644 --- a/src/BetterPhpDocParser/Printer/RemoveNodesStartAndEndResolver.php +++ b/src/BetterPhpDocParser/Printer/RemoveNodesStartAndEndResolver.php @@ -33,7 +33,7 @@ public function resolve(PhpDocNode $originalPhpDocNode, PhpDocNode $currentPhpDo if ($tokens[$seekPosition][1] === Lexer::TOKEN_PHPDOC_EOL) { break; } - // do not colide + // do not collide if ($lastEndPosition < $seekPosition) { break; } diff --git a/src/Caching/Detector/ChangedFilesDetector.php b/src/Caching/Detector/ChangedFilesDetector.php index 8c25cb61c0cf..a27f53b7d510 100644 --- a/src/Caching/Detector/ChangedFilesDetector.php +++ b/src/Caching/Detector/ChangedFilesDetector.php @@ -29,7 +29,7 @@ final class ChangedFilesDetector /** * @var array */ - private array $cachableFiles = []; + private array $cacheableFiles = []; public function __construct(FileHashComputer $fileHashComputer, Cache $cache, FileHasher $fileHasher) { $this->fileHashComputer = $fileHashComputer; @@ -39,16 +39,16 @@ public function __construct(FileHashComputer $fileHashComputer, Cache $cache, Fi public function cacheFile(string $filePath) : void { $filePathCacheKey = $this->getFilePathCacheKey($filePath); - if (!isset($this->cachableFiles[$filePathCacheKey])) { + if (!isset($this->cacheableFiles[$filePathCacheKey])) { return; } $hash = $this->hashFile($filePath); $this->cache->save($filePathCacheKey, CacheKey::FILE_HASH_KEY, $hash); } - public function addCachableFile(string $filePath) : void + public function addCacheableFile(string $filePath) : void { $filePathCacheKey = $this->getFilePathCacheKey($filePath); - $this->cachableFiles[$filePathCacheKey] = \true; + $this->cacheableFiles[$filePathCacheKey] = \true; } public function hasFileChanged(string $filePath) : bool { @@ -65,7 +65,7 @@ public function invalidateFile(string $filePath) : void { $fileInfoCacheKey = $this->getFilePathCacheKey($filePath); $this->cache->clean($fileInfoCacheKey); - unset($this->cachableFiles[$fileInfoCacheKey]); + unset($this->cacheableFiles[$fileInfoCacheKey]); } public function clear() : void { diff --git a/src/Config/Level/CodingStyleLevel.php b/src/Config/Level/CodingStyleLevel.php index 4edb9c600a08..1f5d797ad114 100644 --- a/src/Config/Level/CodingStyleLevel.php +++ b/src/Config/Level/CodingStyleLevel.php @@ -49,7 +49,7 @@ final class CodingStyleLevel * * @var array> */ - public const RULES = [SeparateMultiUseImportsRector::class, NewlineAfterStatementRector::class, RemoveFinalFromConstRector::class, NullableCompareToNullRector::class, ConsistentImplodeRector::class, TernaryConditionVariableAssignmentRector::class, SymplifyQuoteEscapeRector::class, StringClassNameToClassConstantRector::class, CatchExceptionNameMatchingTypeRector::class, SplitDoubleAssignRector::class, EncapsedStringsToSprintfRector::class, WrapEncapsedVariableInCurlyBracesRector::class, NewlineBeforeNewAssignSetRector::class, MakeInheritedMethodVisibilitySameAsParentRector::class, CallUserFuncArrayToVariadicRector::class, VersionCompareFuncCallToConstantRector::class, CountArrayToEmptyArrayComparisonRector::class, CallUserFuncToMethodCallRector::class, FuncGetArgsToVariadicParamRector::class, StrictArraySearchRector::class, UseClassKeywordForClassNameResolutionRector::class, SplitGroupedPropertiesRector::class, SplitGroupedClassConstantsRector::class, ExplicitPublicClassMethodRector::class, RemoveUselessAliasInUseStatementRector::class]; + public const RULES = [SeparateMultiUseImportsRector::class, NewlineAfterStatementRector::class, RemoveFinalFromConstRector::class, NullableCompareToNullRector::class, ConsistentImplodeRector::class, TernaryConditionVariableAssignmentRector::class, SimplifyQuoteEscapeRector::class, StringClassNameToClassConstantRector::class, CatchExceptionNameMatchingTypeRector::class, SplitDoubleAssignRector::class, EncapsedStringsToSprintfRector::class, WrapEncapsedVariableInCurlyBracesRector::class, NewlineBeforeNewAssignSetRector::class, MakeInheritedMethodVisibilitySameAsParentRector::class, CallUserFuncArrayToVariadicRector::class, VersionCompareFuncCallToConstantRector::class, CountArrayToEmptyArrayComparisonRector::class, CallUserFuncToMethodCallRector::class, FuncGetArgsToVariadicParamRector::class, StrictArraySearchRector::class, UseClassKeywordForClassNameResolutionRector::class, SplitGroupedPropertiesRector::class, SplitGroupedClassConstantsRector::class, ExplicitPublicClassMethodRector::class, RemoveUselessAliasInUseStatementRector::class]; /** * @var array, mixed[]> */ diff --git a/src/Configuration/OnlyRuleResolver.php b/src/Configuration/OnlyRuleResolver.php index 53fb4a823c83..89ef735c3825 100644 --- a/src/Configuration/OnlyRuleResolver.php +++ b/src/Configuration/OnlyRuleResolver.php @@ -51,7 +51,7 @@ public function resolve(string $rule) : string if (\count($matching) > 1) { \sort($matching); $message = \sprintf('Short rule name "%s" is ambiguous. Specify the full rule name:' . \PHP_EOL . '- ' . \implode(\PHP_EOL . '- ', $matching), $rule); - throw new RectorRuleNameAmbigiousException($message); + throw new RectorRuleNameAmbiguousException($message); } if (\strpos($rule, '\\') === \false) { $message = \sprintf('Rule "%s" was not found.%sThe rule has no namespace. Make sure to escape the backslashes, and add quotes around the rule name: --only="My\\Rector\\Rule"', $rule, \PHP_EOL); diff --git a/src/Configuration/Option.php b/src/Configuration/Option.php index 42053988c27a..ccda97c7ffb7 100644 --- a/src/Configuration/Option.php +++ b/src/Configuration/Option.php @@ -115,7 +115,7 @@ final class Option */ public const CACHE_DIR = 'cache_dir'; /** - * Cache backend. Most of the time we cache in files, but in ephemeral environment (e.g. CI), a faster `MemoryCacheStorage` can be usefull. + * Cache backend. Most of the time we cache in files, but in ephemeral environment (e.g. CI), a faster `MemoryCacheStorage` can be useful. * @internal Use RectorConfig::cacheClass() instead * * @var class-string diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index 512e3a12fd13..5bb31fbbab76 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -705,7 +705,7 @@ public function withPhpLevel(int $level) : self $setFilePaths = \Rector\Configuration\PhpLevelSetResolver::resolveFromPhpVersion($phpVersion); $rectorRulesWithConfiguration = $setRectorsResolver->resolveFromFilePathsIncludingConfiguration($setFilePaths); foreach ($rectorRulesWithConfiguration as $position => $rectorRuleWithConfiguration) { - // add rules untill level is reached + // add rules until level is reached if ($position > $level) { continue; } diff --git a/src/Console/Command/SetupCICommand.php b/src/Console/Command/SetupCICommand.php index c146ce7a9b1f..3da3474562f2 100644 --- a/src/Console/Command/SetupCICommand.php +++ b/src/Console/Command/SetupCICommand.php @@ -37,7 +37,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int if ($ci === CiDetector::CI_GITHUB_ACTIONS) { return $this->handleGithubActions(); } - $noteMessage = sprintf('Only Github and GitLab are currently supported.%s Contribute your CI template to Rector to make this work: %s', \PHP_EOL, 'https://github.com/rectorphp/rector-src/'); + $noteMessage = sprintf('Only GitHub and GitLab are currently supported.%s Contribute your CI template to Rector to make this work: %s', \PHP_EOL, 'https://github.com/rectorphp/rector-src/'); $this->symfonyStyle->note($noteMessage); return self::SUCCESS; } diff --git a/src/Console/Formatter/ColorConsoleDiffFormatter.php b/src/Console/Formatter/ColorConsoleDiffFormatter.php index dfaf32316a83..09a5c4e86af9 100644 --- a/src/Console/Formatter/ColorConsoleDiffFormatter.php +++ b/src/Console/Formatter/ColorConsoleDiffFormatter.php @@ -23,7 +23,7 @@ final class ColorConsoleDiffFormatter * @var string * @see https://regex101.com/r/xwywpa/1 */ - private const MINUT_START_REGEX = '#^(\\-.*)#'; + private const MINUTE_START_REGEX = '#^(\\-.*)#'; /** * @var string * @see https://regex101.com/r/CMlwa8/1 @@ -71,7 +71,7 @@ private function makePlusLinesGreen(string $string) : string } private function makeMinusLinesRed(string $string) : string { - return Strings::replace($string, self::MINUT_START_REGEX, '$1'); + return Strings::replace($string, self::MINUTE_START_REGEX, '$1'); } private function makeAtNoteCyan(string $string) : string { diff --git a/src/Console/Style/SymfonyStyleFactory.php b/src/Console/Style/SymfonyStyleFactory.php index 20c476ea2de8..5ad348b7ede0 100644 --- a/src/Console/Style/SymfonyStyleFactory.php +++ b/src/Console/Style/SymfonyStyleFactory.php @@ -42,7 +42,7 @@ public function create() : \Rector\Console\Style\RectorStyle return new \Rector\Console\Style\RectorStyle($argvInput, $consoleOutput); } /** - * Never ever used static methods if not neccesary, this is just handy for tests + src to prevent duplication. + * Never ever used static methods if not necessary, this is just handy for tests + src to prevent duplication. */ private function isPHPUnitRun() : bool { diff --git a/src/Exception/Configuration/RectorRuleNameAmbigiousException.php b/src/Exception/Configuration/RectorRuleNameAmbiguousException.php similarity index 60% rename from src/Exception/Configuration/RectorRuleNameAmbigiousException.php rename to src/Exception/Configuration/RectorRuleNameAmbiguousException.php index bc5f9fa8978f..1a723365300a 100644 --- a/src/Exception/Configuration/RectorRuleNameAmbigiousException.php +++ b/src/Exception/Configuration/RectorRuleNameAmbiguousException.php @@ -4,6 +4,6 @@ namespace Rector\Exception\Configuration; use Exception; -final class RectorRuleNameAmbigiousException extends Exception +final class RectorRuleNameAmbiguousException extends Exception { } diff --git a/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php b/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php index 4fefc90bf624..12c7df75448e 100644 --- a/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php +++ b/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php @@ -97,10 +97,10 @@ public function hasChanged() : bool { return $this->hasChanged; } - private function ensureFQCNObject(ObjectType $objectType, string $identiferName) : ObjectType + private function ensureFQCNObject(ObjectType $objectType, string $identifierName) : ObjectType { - if ($objectType instanceof ShortenedObjectType && \strncmp($identiferName, '\\', \strlen('\\')) === 0) { - return new ObjectType(\ltrim($identiferName, '\\')); + if ($objectType instanceof ShortenedObjectType && \strncmp($identifierName, '\\', \strlen('\\')) === 0) { + return new ObjectType(\ltrim($identifierName, '\\')); } if ($objectType instanceof ShortenedObjectType || $objectType instanceof AliasedObjectType) { return new ObjectType($objectType->getFullyQualifiedName()); diff --git a/src/PhpDocParser/ValueObject/AttributeKey.php b/src/PhpDocParser/ValueObject/AttributeKey.php index 7465777f4ffd..42ab376b4a2d 100644 --- a/src/PhpDocParser/ValueObject/AttributeKey.php +++ b/src/PhpDocParser/ValueObject/AttributeKey.php @@ -9,7 +9,7 @@ final class AttributeKey { /** - * Used in php-paser, do not change + * Used in php-parser, do not change * * @var string */ diff --git a/src/Util/ArrayParametersMerger.php b/src/Util/ArrayParametersMerger.php index 7cd427fdc99a..4de0f3660703 100644 --- a/src/Util/ArrayParametersMerger.php +++ b/src/Util/ArrayParametersMerger.php @@ -8,7 +8,7 @@ final class ArrayParametersMerger /** * Merges configurations. Left has higher priority than right one. * - * @autor David Grudl (https://davidgrudl.com) + * @author David Grudl (https://davidgrudl.com) * @source https://github.com/nette/di/blob/8eb90721a131262f17663e50aee0032a62d0ef08/src/DI/Config/Helpers.php#L31 * @param mixed $left * @param mixed $right diff --git a/src/Util/FileHasher.php b/src/Util/FileHasher.php index 27de016e0b46..eeae1f1198d0 100644 --- a/src/Util/FileHasher.php +++ b/src/Util/FileHasher.php @@ -10,14 +10,14 @@ final class FileHasher { /** - * cryptographic insecure hasing of a string + * cryptographic insecure hashing of a string */ public function hash(string $string) : string { return \hash($this->getAlgo(), $string); } /** - * cryptographic insecure hasing of files + * cryptographic insecure hashing of files * * @param string[] $files */