0.3.0
What's Changed
Updated for PHPUnit 11. This is has required a major shift away from overriding createMock
and requiring extension or trait usage via static analysis. This is due to (understandably) PHPUnit making their internal methods final
.
To enforce not using return value generation for test doubles, and error out instead, you have 3 options:
- Use the
StrictMocking
trait, and callcreateStrictMock()
explicitly. The PHPStan rules bundled will enforce this usage if the trait is used. - Extend the
TestCase
abstract class provided, and callcreateStrictMock()
explicitly. The PHPStan rules bundled will enforce this usage if this class is extended from. - Add
#[DisableReturnValueGenerationForTestDoubles]
to your test cases. The Rector ruleEnforceDisableReturnValueGenerationForTestDoublesRector
shipped will enforce/automate adding this to be added to all test cases.
Full Changelog: 0.2.0...0.3.0