Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check interfaces that extend other interfaces. #120

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

jongardiner
Copy link
Contributor

If both list a method, then the signature must be compatible.

  • Check interfaces "implemented" by an abstract base class. The base class doesn't need to actually implement, any non-abstract classes do.

…d, then the signature must be compatible.

- Check interfaces "implemented" by an abstract base class.  The base class doesn't need to actually implement, any non-abstract classes do.
@jongardiner jongardiner requested a review from a team as a code owner July 10, 2024 00:57
@@ -203,13 +175,16 @@ protected function implementsMethod(Class_ $node, $interfaceMethod) {
*/
public function run($fileName, Node $node, ClassLike $inside = null, Scope $scope = null) {
if ($node instanceof Class_) {
if ($node->implements) {
if ($node->implements || $node->extends) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the meat of the change. If a class implements OR extends any class, then we build a deep list of interfaces and confirm that you implement all the methods.

$this->processNodeImplements($fileName, $node);
}
if ($node->extends) {
$this->processNodeExtends($fileName, $node);
}
}
if ($node instanceof Interface_ && $node->extends) {
$this->processNodeImplements($fileName, $node);
}
Copy link
Contributor Author

@jongardiner jongardiner Jul 10, 2024

Choose a reason for hiding this comment

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

This is a new check. If you have one interface that extends other interfaces, then we make sure that any common methods have compatible signatures.

@jongardiner jongardiner merged commit 29ab7c5 into master Jul 10, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants