diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 53fb96b..f56b3cf 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -14,3 +14,8 @@ parameters: message: "#^Accessing PHPStan\\\\Rules\\\\Comparison\\\\ImpossibleCheckTypeMethodCallRule\\:\\:class is not covered by backward compatibility promise\\. The class might change in a minor PHPStan version\\.$#" count: 1 path: tests/Rules/PHPUnit/ImpossibleCheckTypeMethodCallRuleTest.php + + - + message: "#^Accessing PHPStan\\\\Rules\\\\Methods\\\\CallMethodsRule\\:\\:class is not covered by backward compatibility promise\\. The class might change in a minor PHPStan version\\.$#" + count: 1 + path: tests/Rules/Methods/CallMethodsRuleTest.php diff --git a/tests/Rules/Methods/CallMethodsRuleTest.php b/tests/Rules/Methods/CallMethodsRuleTest.php new file mode 100644 index 0000000..99d572f --- /dev/null +++ b/tests/Rules/Methods/CallMethodsRuleTest.php @@ -0,0 +1,34 @@ + + */ +class CallMethodsRuleTest extends RuleTestCase +{ + + protected function getRule(): Rule + { + return self::getContainer()->getByType(CallMethodsRule::class); + } + + public function testBug222(): void + { + $this->analyse([__DIR__ . '/data/bug-222.php'], []); + } + + /** + * @return string[] + */ + public static function getAdditionalConfigFiles(): array + { + return [ + __DIR__ . '/../../../extension.neon', + ]; + } + +} diff --git a/tests/Rules/Methods/data/bug-222.php b/tests/Rules/Methods/data/bug-222.php new file mode 100644 index 0000000..d07ca14 --- /dev/null +++ b/tests/Rules/Methods/data/bug-222.php @@ -0,0 +1,34 @@ +expects($this->exactly(1)) + ->method('get') + ->with(24) + ->willReturn('24'); + + $mockService + ->method('get') + ->with(24) + ->willReturn('24'); + + $mockService + ->expects($this->exactly(1)) + ->method('get') + ->willReturn('24'); + + $mockService + ->method('get') + ->willReturn('24'); + } + +}