diff --git a/AGENTS.md b/AGENTS.md index 4ff333d..1085846 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -33,7 +33,7 @@ Layout: metadata is ignored by PHPUnit, so the plugin reports it and stops honouring it in `TestCaseHandler`. - `src/Hooks/MissingParentCallHandler.php` and `src/Issue/MissingParentCall.php`: the `AfterClassLikeAnalysis` hook and plugin issue for `setUp()`-style overrides without a `parent::` call. -- `stubs/TestCase.phpstub`: hides the constructor of `TestCase` (see the stub) and makes `assertNotEmpty()` +- `stubs/TestCase.phpstub`: declares the constructor of `TestCase` (see the stub) and makes `assertNotEmpty()` narrow its argument. - `tests/acceptance/*.feature`: the Behat scenarios, the only test suite that CI runs. One file per area (`DataProviders`, `NamedDatasets`, `Narrowing`, `MockMethod`, ...): add a scenario to the file of the area diff --git a/stubs/TestCase.phpstub b/stubs/TestCase.phpstub index 77508e7..df2495a 100644 --- a/stubs/TestCase.phpstub +++ b/stubs/TestCase.phpstub @@ -2,11 +2,12 @@ namespace PHPUnit\Framework; /** - * Without a constructor here, Psalm reports a property that setUp() initializes as MissingConstructor, which - * TestCaseHandler suppresses, rather than as PropertyNotSetInConstructor of TestCase's final constructor. + * Psalm doesn't analyse a stubbed constructor, so it reports a property that a test case leaves uninitialized as + * MissingConstructor, which TestCaseHandler suppresses when setUp() or another initializer sets it. */ abstract class TestCase extends Assert implements Test, SelfDescribing { + final public function __construct(string $name) {} } abstract class Assert