Skip to content

Commit b789f2d

Browse files
committed
[solid] make AbstractRector::leave() final, to avoid breaking removing mechanism in child classes
1 parent 768c5cd commit b789f2d

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Console/Command/ProcessCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
117117

118118
// 2. add files and directories to static locator
119119
$this->dynamicSourceLocatorDecorator->addPaths($paths);
120-
if ($this->dynamicSourceLocatorDecorator->isPathsEmpty()) {
120+
if ($this->dynamicSourceLocatorDecorator->arePathsEmpty()) {
121121
// read from rector.php, no paths definition needs withPaths() config
122122
if ($paths === []) {
123123
$this->symfonyStyle->error(

src/FamilyTree/NodeAnalyzer/ClassChildAnalyzer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private function resolveToStringNativeTypeFromAstResolver(PhpMethodReflection $p
8282

8383
if ($class instanceof ClassLike) {
8484
$classMethod = $class->getMethod($phpMethodReflection->getName());
85-
if ($classMethod instanceof ClassMethod && !$classMethod->returnType instanceof Node) {
85+
if ($classMethod instanceof ClassMethod && ! $classMethod->returnType instanceof Node) {
8686
return new MixedType();
8787
}
8888
}

src/Rector/AbstractRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ final public function enterNode(Node $node): int|Node|null
190190
* Replacing nodes in leaveNode() method avoids infinite recursion
191191
* see"infinite recursion" in https://github.com/nikic/PHP-Parser/blob/master/doc/component/Walking_the_AST.markdown
192192
*/
193-
public function leaveNode(Node $node): array|int|Node|null
193+
final public function leaveNode(Node $node): array|int|Node|null
194194
{
195195
if ($node->hasAttribute(AttributeKey::ORIGINAL_NODE)) {
196196
return null;

src/StaticReflection/DynamicSourceLocatorDecorator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function addPaths(array $paths): void
3939
$this->dynamicSourceLocatorProvider->addDirectories($directories);
4040
}
4141

42-
public function isPathsEmpty(): bool
42+
public function arePathsEmpty(): bool
4343
{
4444
return $this->dynamicSourceLocatorProvider->arePathsEmpty();
4545
}

0 commit comments

Comments
 (0)