From d98b17db5bad233d5493894fa311bec7f858ba66 Mon Sep 17 00:00:00 2001 From: phpstan-bot Date: Thu, 19 Feb 2026 11:56:01 +0000 Subject: [PATCH] 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 --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index c86df268..440ee842 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ This extension provides following features: * `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. * `getMock()` called on `MockBuilder` is also supported. +* `createMockForIntersectionOfInterfaces()` and `createStubForIntersectionOfInterfaces()` return correct intersection types. * Interprets `Foo|MockObject` in phpDoc so that it results in an intersection type instead of a union type. * Defines early terminating method calls for the `PHPUnit\Framework\TestCase` class to prevent undefined variable errors. * 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 * Check that you are not using `assertSame()` with `count($variable)` as second parameter. `assertCount($variable)` should be used instead. * Check that you are not using `assertEquals()` with same types (`assertSame()` should be used) * Check that you are not using `assertNotEquals()` with same types (`assertNotSame()` should be used) +* Validate `@covers` and `@coversDefaultClass` annotations reference existing classes, methods, and functions. +* Check that methods called on mock objects via `->method('...')` exist on the mocked class. +* Check that `setUp()` and `tearDown()` call their parent methods. +* Validate data provider declarations (method existence, naming, static requirement in PHPUnit 10+). +* Validate data provider return data matches test method parameters (bleeding edge). +* Validate `#[RequiresPhp]` attribute format. +* Check for proper spacing in PHPUnit annotations. ## How to document mock objects in phpDocs?