Skip to content

Commit b9e6771

Browse files
return if method is private
1 parent 420456b commit b9e6771

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rules/TypeDeclaration/Rector/ClassMethod/NarrowObjectReturnTypeRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ private function isNarrowingValid(string $declaredType, string $actualType): boo
190190

191191
private function hasParentMethodWithNonObjectReturn(ClassMethod $classMethod): bool
192192
{
193+
if ($classMethod->isPrivate()) {
194+
return false;
195+
}
196+
193197
$classReflection = $this->reflectionResolver->resolveClassReflection($classMethod);
194198

195199
if (! $classReflection instanceof ClassReflection) {

0 commit comments

Comments
 (0)