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

Fix: Exclude interfaces from analysis by Methods\FinalInAbstractClassRule #132

Merged
merged 2 commits into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased

For a full diff see [`0.12.1...master`](https://github.com/localheinz/phpstan-rules/compare/0.11.0...master).
For a full diff see [`0.12.2...master`](https://github.com/localheinz/phpstan-rules/compare/0.12.2...master).

## [`0.12.2`](https://github.com/localheinz/phpstan-rules/releases/tag/0.12.2)

For a full diff see [`0.12.0...0.12.1`](https://github.com/localheinz/phpstan-rules/compare/0.12.1...0.12.2).

### Fixed

* Started ignoring interfaces from analysis by `Methods\FinalInAbstractClassRule` to avoid inappropriate errors ([#132](https://github.com/localheinz/phpstan-rules/pull/132)), by [@localheinz](https://github.com/localheinz)

## [`0.12.1`](https://github.com/localheinz/phpstan-rules/releases/tag/0.12.1)

Expand Down
4 changes: 4 additions & 0 deletions src/Methods/FinalInAbstractClassRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

if ($containingClass->isInterface()) {
return [];
}

if ($node->isAbstract()) {
return [];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace Localheinz\PHPStan\Rules\Test\Fixture\Methods\FinalInAbstractClassRule\Success;

interface InterfaceWithPublicMethod
{
public function method(): void;
}
1 change: 1 addition & 0 deletions test/Integration/Methods/FinalInAbstractClassRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function providerAnalysisSucceeds(): iterable
'abstract-class-with-final-protected-method' => __DIR__ . '/../../Fixture/Methods/FinalInAbstractClassRule/Success/AbstractClassWithFinalProtectedMethod.php',
'abstract-class-with-final-public-method' => __DIR__ . '/../../Fixture/Methods/FinalInAbstractClassRule/Success/AbstractClassWithFinalPublicMethod.php',
'abstract-class-with-private-method' => __DIR__ . '/../../Fixture/Methods/FinalInAbstractClassRule/Success/AbstractClassWithPrivateMethod.php',
'interface-with-public-method' => __DIR__ . '/../../Fixture/Methods/FinalInAbstractClassRule/Success/InterfaceWithPublicMethod.php',
];

foreach ($paths as $description => $path) {
Expand Down