From 99461a227087941f4179e0513567da03cc37d179 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin <5278175+alies-dev@users.noreply.github.com> Date: Sun, 21 Jun 2026 10:49:20 +0200 Subject: [PATCH 1/2] Rewrite README to explain what the plugin does and why to use it --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6f8207f..bce6905 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,20 @@ -# phpunit-psalm-plugin +# psalm-plugin-phpunit -A PHPUnit plugin for [Psalm](https://github.com/vimeo/psalm) (requires Psalm v4+). +A [Psalm](https://github.com/vimeo/psalm) plugin that teaches Psalm about PHPUnit (requires Psalm v4+). -Installation: +## What it does + +Psalm does not understand PHPUnit conventions on its own. This plugin makes Psalm aware of them, so static analysis of your test suite stops flooding you with false positives. + +## Features + +* **Silences false `MissingConstructor`** on stateful test cases. Properties initialized in `setUp()` or a `@before` / `#[Before]` method are recognized as initialized. +* **Validates data providers.** It checks that a referenced provider exists, returns an `iterable` (array, generator, or object), and that each dataset shape matches the parameters of the test method it feeds (types, count, optional offsets, variadic params, defaults). +* **Reports broken providers.** Missing providers, wrong return types, mismatched dataset types, and providers returning `null` are flagged before the suite ever runs. +* **Fixes unused-code detection for tests.** Test methods, providers referenced from docblocks or attributes, and `TestCase` descendants are no longer reported as unused, while genuinely dead test helpers still are. +* **Types `prophesize()`.** `$this->prophesize(Foo::class)` is inferred as `ObjectProphecy`, so calls on the prophecy are type-checked. + +## Installation ``` composer require --dev psalm/plugin-phpunit From 486052b7df5dbf16f88323b2084e4af9fc8c2da8 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin <5278175+alies-dev@users.noreply.github.com> Date: Sun, 21 Jun 2026 10:50:33 +0200 Subject: [PATCH 2/2] Use neutral tagline wording --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bce6905..ed3195a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # psalm-plugin-phpunit -A [Psalm](https://github.com/vimeo/psalm) plugin that teaches Psalm about PHPUnit (requires Psalm v4+). +A [Psalm](https://github.com/vimeo/psalm) plugin for PHPUnit (requires Psalm v4+). ## What it does