Skip to content

Commit d98b17d

Browse files
phpstan-botclaude
andcommitted
Update README with missing feature descriptions
Add documentation for features present in src/ and rules.neon that were not listed in the README: Core features: - createMockForIntersectionOfInterfaces() / createStubForIntersectionOfInterfaces() Strict rules: - @Covers / @coversDefaultClass annotation validation - Mock method call existence checking - setUp() / tearDown() parent method call enforcement - Data provider declaration validation - Data provider data validation (bleeding edge) - #[RequiresPhp] attribute format validation - PHPUnit annotation spacing checks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bb6479c commit d98b17d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This extension provides following features:
1111

1212
* `createMock()`, `getMockForAbstractClass()` and `getMockFromWsdl()` methods return an intersection type (see the [detailed explanation of intersection types](https://phpstan.org/blog/union-types-vs-intersection-types)) of the mock object and the mocked class so that both methods from the mock object (like `expects`) and from the mocked class are available on the object.
1313
* `getMock()` called on `MockBuilder` is also supported.
14+
* `createMockForIntersectionOfInterfaces()` and `createStubForIntersectionOfInterfaces()` return correct intersection types.
1415
* Interprets `Foo|MockObject` in phpDoc so that it results in an intersection type instead of a union type.
1516
* Defines early terminating method calls for the `PHPUnit\Framework\TestCase` class to prevent undefined variable errors.
1617
* Specifies types of expressions passed to various `assert` methods like `assertInstanceOf`, `assertTrue`, `assertInternalType` etc.
@@ -24,6 +25,13 @@ It also contains this strict framework-specific rules (can be enabled separately
2425
* Check that you are not using `assertSame()` with `count($variable)` as second parameter. `assertCount($variable)` should be used instead.
2526
* Check that you are not using `assertEquals()` with same types (`assertSame()` should be used)
2627
* Check that you are not using `assertNotEquals()` with same types (`assertNotSame()` should be used)
28+
* Validate `@covers` and `@coversDefaultClass` annotations reference existing classes, methods, and functions.
29+
* Check that methods called on mock objects via `->method('...')` exist on the mocked class.
30+
* Check that `setUp()` and `tearDown()` call their parent methods.
31+
* Validate data provider declarations (method existence, naming, static requirement in PHPUnit 10+).
32+
* Validate data provider return data matches test method parameters (bleeding edge).
33+
* Validate `#[RequiresPhp]` attribute format.
34+
* Check for proper spacing in PHPUnit annotations.
2735

2836
## How to document mock objects in phpDocs?
2937

0 commit comments

Comments
 (0)