Skip to content
Permalink
Browse files

Fix broken behaviour when analysing interface test methods

  • Loading branch information...
muglug committed Jul 28, 2019
1 parent f432cc0 commit 90854c4094fdd731f1210ed742b9d0a282b94f14
@@ -2282,7 +2282,7 @@ Emitted when a class extends another, but does not implement all of its abstract

```php
abstract class A {
abstract public function foo();
abstract public function foo() : void;
}
class B extends A {}
```
@@ -2293,7 +2293,7 @@ Emitted when a class `implements` an interface but does not implement all of its

```php
interface I {
public function foo();
public function foo() : void;
}
class A implements I {}
```
@@ -1640,6 +1640,8 @@ public static function analyzeClassMethodReturnType(
);
}
$original_fq_classlike_name = $fq_classlike_name;
$return_type = $codebase->methods->getMethodReturnType($analyzed_method_id, $fq_classlike_name);
if ($return_type && $class_storage->template_type_extends) {
@@ -1656,7 +1658,7 @@ public static function analyzeClassMethodReturnType(
$class_template_params = Statements\Expression\Call\MethodCallAnalyzer::getClassTemplateParams(
$codebase,
$class_storage,
$fq_classlike_name,
$original_fq_classlike_name,
strtolower($stmt->name->name)
) ?: [];
@@ -1671,7 +1673,10 @@ public static function analyzeClassMethodReturnType(
$overridden_method_ids['overridden::downstream'] = 'overridden::downstream';
}
if (!$return_type && isset($class_storage->interface_method_ids[strtolower($stmt->name->name)])) {
if (!$return_type
&& !$class_storage->is_interface
&& isset($class_storage->interface_method_ids[strtolower($stmt->name->name)])
) {
$interface_method_ids = $class_storage->interface_method_ids[strtolower($stmt->name->name)];
foreach ($interface_method_ids as $interface_method_id) {
@@ -116,7 +116,7 @@ public function analyze()
$actual_method_id,
$actual_method_id
);
}
}
} elseif ($stmt instanceof PhpParser\Node\Stmt\Property) {
\Psalm\IssueBuffer::add(
new \Psalm\Issue\ParseError(
@@ -582,7 +582,7 @@ abstract class A {}
'abstractClassMethod' => [
'<?php
abstract class A {
abstract public function foo();
abstract public function foo() : void;
}
class B extends A { }',
@@ -752,7 +752,7 @@ class A {
'allowImplementMethodMadePublicInClass' => [
'<?php
interface I {
public function boo();
public function boo() : void;
}
trait T {
@@ -766,7 +766,7 @@ class A implements I {
'allowImplementMethodMadePublicInParent' => [
'<?php
interface I {
public function boo();
public function boo() : void;
}
trait T {
@@ -496,7 +496,7 @@ class A {
public function bat() : void {}
}
interface I {
public function baz();
public function baz() : void;
}
function foo(I $i) : void {

0 comments on commit 90854c4

Please sign in to comment.
You can’t perform that action at this time.