1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix #1125 - check protected method overridden ids for use

This commit is contained in:
Brown 2018-12-13 17:20:29 -05:00
parent fa9a04369b
commit 341cb0c82c
2 changed files with 20 additions and 1 deletions

View File

@ -778,7 +778,7 @@ class ClassLikes
$method_id = $classlike_storage->name . '::' . $method_storage->cased_name;
if ($method_storage->visibility === ClassLikeAnalyzer::VISIBILITY_PUBLIC) {
if ($method_storage->visibility !== ClassLikeAnalyzer::VISIBILITY_PRIVATE) {
$method_name_lc = strtolower($method_name);
$has_parent_references = false;

View File

@ -322,6 +322,25 @@ class UnusedCodeTest extends TestCase
new A();',
],
'abstractMethodImplementerCoveredByParentCall' => [
'<?php
abstract class Foobar {
public function doIt(): void {
$this->inner();
}
abstract protected function inner(): void;
}
class MyFooBar extends Foobar {
protected function inner(): void {
// Do nothing
}
}
$myFooBar = new MyFooBar();
$myFooBar->doIt();',
],
];
}