From 208ba0b60da8001b7114057a31a2f5a025ec4f88 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 11 Mar 2024 07:07:52 +0700 Subject: [PATCH] [Performance][CodingStyle] Check public method only for verify override interface --- .../MakeInheritedMethodVisibilitySameAsParentRector.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php b/rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php index 52f714342d9..46bde460714 100644 --- a/rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php @@ -106,9 +106,11 @@ public function refactor(Node $node): ?Node /** @var string $methodName */ $methodName = $this->getName($classMethod->name); - foreach ($interfaces as $interface) { - if ($interface->hasNativeMethod($methodName)) { - continue 2; + if ($classMethod->isPublic()) { + foreach ($interfaces as $interface) { + if ($interface->hasNativeMethod($methodName)) { + continue 2; + } } }