Skip to content

Commit

Permalink
[CodingStyle] Skip equal modifier on direct parent method compatible …
Browse files Browse the repository at this point in the history
…on MakeInheritedMethodVisibilitySameAsParentRector (#6406)
  • Loading branch information
samsonasik authored Oct 30, 2024
1 parent d246d27 commit 2d862a7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Rector\Tests\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector\Fixture;

use Rector\Tests\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector\Source\Father;

class SkipEqualDirectParent extends Father
{
public function run()
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector\Source;

class Father extends GrandFather
{
public function run()
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector\Source;

class GrandFather
{
protected function run()
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function refactor(Node $node): ?Node
/** @var ReflectionMethod $parentReflectionMethod */
$parentReflectionMethod = $nativeClassReflection->getMethod($methodName);
if ($this->isClassMethodCompatibleWithParentReflectionMethod($classMethod, $parentReflectionMethod)) {
continue;
continue 2;
}

$this->changeClassMethodVisibilityBasedOnReflectionMethod($classMethod, $parentReflectionMethod);
Expand Down

0 comments on commit 2d862a7

Please sign in to comment.