1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +01:00

Check that non-user-defined abstract methods are implemented, too

This commit is contained in:
Matthew Brown 2018-07-21 20:50:42 -04:00
parent bc23f732a4
commit 200ea70334
2 changed files with 15 additions and 4 deletions

View File

@ -235,6 +235,8 @@ class Reflection
$declaring_class = $method->getDeclaringClass(); $declaring_class = $method->getDeclaringClass();
$storage->is_static = $method->isStatic(); $storage->is_static = $method->isStatic();
$storage->abstract = $method->isAbstract();
$class_storage->declaring_method_ids[$method_name] = $class_storage->declaring_method_ids[$method_name] =
$declaring_class->name . '::' . strtolower((string)$method->getName()); $declaring_class->name . '::' . strtolower((string)$method->getName());

View File

@ -447,11 +447,20 @@ class ClassTest extends TestCase
], ],
'abstractClassMethod' => [ 'abstractClassMethod' => [
'<?php '<?php
abstract class A { abstract class A {
abstract public function foo(); abstract public function foo();
} }
class B extends A { }', class B extends A { }',
'error_message' => 'UnimplementedAbstractMethod',
],
'abstractReflectedClassMethod' => [
'<?php
class DedupeIterator extends FilterIterator {
public function __construct(Iterator $i) {
parent::__construct($i);
}
}',
'error_message' => 'UnimplementedAbstractMethod', 'error_message' => 'UnimplementedAbstractMethod',
], ],
'missingParent' => [ 'missingParent' => [