Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Commit

Permalink
Don't try to add <<__Override>> to private methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fredemmott committed Sep 26, 2017
1 parent af27365 commit 378125c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Linters/MustUseOverrideAttributeLinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
GenericTypeSpecifier,
ListItem,
MethodishDeclaration,
PrivateToken,
SimpleTypeSpecifier
};
use namespace Facebook\TypeAssert;
Expand Down Expand Up @@ -124,6 +125,13 @@ private function canIgnoreMethod(
return true;
}

$private = $method->getModifiersx()->getDescendantsOfType(
PrivateToken::class,
) |> C\first($$);
if ($private !== null) {
return true;
}

if (!$class->getKeyword() instanceof ClassToken) {
return true;
}
Expand Down

1 comment on commit 378125c

@fredemmott
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I'm a little surprised this works, but it's valid: https://3v4l.org/2r1sW

Please sign in to comment.