psalm / plugin-phpunit
Psalm plugin for PHPUnit
Package info
github.com/psalm/psalm-plugin-phpunit
Language:Gherkin
Type:psalm-plugin
pkg:composer/psalm/plugin-phpunit
0.21.1
2026-10-20 11:28 UTC
Requires
- php: >=8.1
- ext-simplexml: *
- psalm/psalm-plugin-api: ^0.4
Requires (Dev)
- php: ^7.3 || ^8.0
- phpunit/phpunit: ^10.0 || ^11.0 || ^12.0
- squizlabs/php_codesniffer: ^3.3.1
- vimeo/psalm: ^7|dev-master
- weirdan/prophecy-shim: ^1.0 || ^2.0
Suggests
None
Provides
None
Conflicts
- phpspec/prophecy: <1.20.0
- phpspec/prophecy-phpunit: <2.3.0
- phpunit/phpunit: <8.5.1
Replaces
None
- dev-master
- 0.21.1
- 0.21.0
- 0.20.4
- 0.20.3
- 0.20.2
- 0.20.1
- 0.20.0
- 0.19.7
- 0.19.5
- 0.19.4
- 0.19.3
- 0.19.2
- 0.19.0
- 0.18.4
- 0.18.3
- 0.18.2
- 0.18.1
- 0.18.0
- 0.17.0
- 0.16.1
- 0.16.0
- 0.15.2
- 0.15.1
- 0.15.0
- 0.14.0
- 0.13.0
- 0.12.2
- 0.12.1
- 0.12.0
- 0.11.0
- 0.10.1
- 0.10.0
- 0.9.2
- 0.9.1
- 0.9.0
- 0.8.1
- 0.8.0
- 0.7.0
- 0.6.0
- 0.5.8
- 0.5.7
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.1
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.1
- 0.1.0
- dev-annotate-fixture-purity
- dev-psalm-7
This package is auto-updated.
Last update: 2026-10-20 12:29:51 UTC
README
A Psalm plugin for PHPUnit (requires Psalm v4+).
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
MissingConstructoron stateful test cases. Properties initialized insetUp()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
nullare flagged before the suite ever runs. - Fixes unused-code detection for tests. Test methods, providers referenced from docblocks or attributes, and
TestCasedescendants are no longer reported as unused, while genuinely dead test helpers still are. - Types
prophesize().$this->prophesize(Foo::class)is inferred asObjectProphecy<Foo>, so calls on the prophecy are type-checked.
Installation
composer require --dev psalm/plugin-phpunit
vendor/bin/psalm-plugin enable psalm/plugin-phpunit