Skip to content
Permalink
Browse files

Apparently the @method annotation is not inherited from the parent in…

…terface

./tools/psalm --config=.psalm/static-analysis.xml --no-progress

INFO: PropertyNotSetInConstructor - tests/static-analysis/TestUsingMocks.php:25:13 - Property PHPUnit\Framework\TestCase::$backupGlobals is not defined in constructor of PHPUnit\StaticAnalysis\TestUsingMocks or in any methods called in the constructor
final class TestUsingMocks extends TestCase

ERROR: UndefinedInterfaceMethod - tests/static-analysis/TestUsingMocks.php:32:15 - Method (PHPUnit\Framework\MockObject\MockObject&PHPUnit\StaticAnalysis\HelloWorldClass)::method does not exist
            ->method('sayHello')

ERROR: MixedMethodCall - tests/static-analysis/TestUsingMocks.php:33:15 - Cannot determine the type of the object on the left hand side of this expression
            ->willReturn('hello mock!');

ERROR: UndefinedInterfaceMethod - tests/static-analysis/TestUsingMocks.php:43:15 - Method (PHPUnit\Framework\MockObject\MockObject&PHPUnit\StaticAnalysis\HelloWorldClass)::method does not exist
            ->method('sayHello')

ERROR: MixedMethodCall - tests/static-analysis/TestUsingMocks.php:44:15 - Cannot determine the type of the object on the left hand side of this expression
            ->willReturn('hello mock!');

ERROR: UndefinedInterfaceMethod - tests/static-analysis/TestUsingMocks.php:54:15 - Method (PHPUnit\Framework\MockObject\MockObject&PHPUnit\StaticAnalysis\HelloWorldClass)::method does not exist
            ->method('sayHello')

ERROR: MixedMethodCall - tests/static-analysis/TestUsingMocks.php:55:15 - Cannot determine the type of the object on the left hand side of this expression
            ->willReturn('hello mock!');

ERROR: UndefinedInterfaceMethod - tests/static-analysis/TestUsingMocks.php:65:15 - Method (PHPUnit\Framework\MockObject\MockObject&PHPUnit\StaticAnalysis\HelloWorldClass)::method does not exist
            ->method('sayHello')

ERROR: MixedMethodCall - tests/static-analysis/TestUsingMocks.php:66:15 - Cannot determine the type of the object on the left hand side of this expression
            ->willReturn('hello mock!');

ERROR: UndefinedInterfaceMethod - tests/static-analysis/TestUsingMocks.php:78:15 - Method (PHPUnit\Framework\MockObject\MockObject&PHPUnit\StaticAnalysis\HelloWorldClass)::method does not exist
            ->method('sayHello')

ERROR: MixedMethodCall - tests/static-analysis/TestUsingMocks.php:79:15 - Cannot determine the type of the object on the left hand side of this expression
            ->willReturn('hello mock!');

------------------------------
10 errors found
------------------------------
1 other issues found.
You can hide them with --show-info=false
------------------------------
  • Loading branch information...
sebastianbergmann committed Jun 28, 2019
1 parent b06bf10 commit 75108d445fed808e56c4160287cdc87be92c087c
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/Framework/MockObject/MockObject.php
@@ -12,6 +12,9 @@
use PHPUnit\Framework\MockObject\Builder\InvocationMocker as BuilderInvocationMocker;
use PHPUnit\Framework\MockObject\Matcher\Invocation;
/**
* @method BuilderInvocationMocker method($constraint)
*/
interface MockObject extends Stub
{
public function __phpunit_setOriginalObject($originalObject): void;

2 comments on commit 75108d4

@sebastianbergmann

This comment has been minimized.

Copy link
Owner Author

replied Jun 28, 2019

@muglug This may be of interest to you.

@sebastianbergmann

This comment has been minimized.

Copy link
Owner Author

replied Jun 28, 2019

@Ocramius This may be of interest to you.

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