From 3e23ca9fefadcc24ba94618c95176e13c1ab5a79 Mon Sep 17 00:00:00 2001 From: BluePsyduck Date: Tue, 25 Sep 2018 17:38:10 +0200 Subject: [PATCH 1/2] Fixes failing tests in current master. --- tests/Rules/PHPUnit/AssertSameMethodDifferentTypesRuleTest.php | 2 +- .../PHPUnit/AssertSameStaticMethodDifferentTypesRuleTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Rules/PHPUnit/AssertSameMethodDifferentTypesRuleTest.php b/tests/Rules/PHPUnit/AssertSameMethodDifferentTypesRuleTest.php index dc3bb7e..95128c4 100644 --- a/tests/Rules/PHPUnit/AssertSameMethodDifferentTypesRuleTest.php +++ b/tests/Rules/PHPUnit/AssertSameMethodDifferentTypesRuleTest.php @@ -12,7 +12,7 @@ class AssertSameMethodDifferentTypesRuleTest extends \PHPStan\Testing\RuleTestCa protected function getRule(): Rule { - return new ImpossibleCheckTypeMethodCallRule(new ImpossibleCheckTypeHelper($this->getTypeSpecifier()), true); + return new ImpossibleCheckTypeMethodCallRule(new ImpossibleCheckTypeHelper($this->createBroker(), $this->getTypeSpecifier()), true); } /** diff --git a/tests/Rules/PHPUnit/AssertSameStaticMethodDifferentTypesRuleTest.php b/tests/Rules/PHPUnit/AssertSameStaticMethodDifferentTypesRuleTest.php index 7fbda4f..977b62c 100644 --- a/tests/Rules/PHPUnit/AssertSameStaticMethodDifferentTypesRuleTest.php +++ b/tests/Rules/PHPUnit/AssertSameStaticMethodDifferentTypesRuleTest.php @@ -12,7 +12,7 @@ class AssertSameStaticMethodDifferentTypesRuleTest extends \PHPStan\Testing\Rule protected function getRule(): Rule { - return new ImpossibleCheckTypeStaticMethodCallRule(new ImpossibleCheckTypeHelper($this->getTypeSpecifier()), true); + return new ImpossibleCheckTypeStaticMethodCallRule(new ImpossibleCheckTypeHelper($this->createBroker(), $this->getTypeSpecifier()), true); } /** From 65e6eaa9d3911c64c3bda4330c9bd03202d704e7 Mon Sep 17 00:00:00 2001 From: BluePsyduck Date: Tue, 25 Sep 2018 17:41:29 +0200 Subject: [PATCH 2/2] Fixes failing to recognize mock methods when using getMockForTrait(). --- src/Type/PHPUnit/MockBuilderDynamicReturnTypeExtension.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Type/PHPUnit/MockBuilderDynamicReturnTypeExtension.php b/src/Type/PHPUnit/MockBuilderDynamicReturnTypeExtension.php index b75c69f..d85af32 100644 --- a/src/Type/PHPUnit/MockBuilderDynamicReturnTypeExtension.php +++ b/src/Type/PHPUnit/MockBuilderDynamicReturnTypeExtension.php @@ -49,6 +49,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method [ 'getMock', 'getMockForAbstractClass', + 'getMockForTrait', ], true )) {