{"record":{"id":"6ed28091b14b324a","repo":"rectorphp/rector","slug":"s-is-deprecated-as-data-provider-docblock-typi","errorCode":null,"errorMessage":"\"%s\" is deprecated, as data provider docblock typing is not relevant to code quality","messagePattern":"\"(.+?)\" is deprecated, as data provider docblock typing is not relevant to code quality","errorType":"exception","errorClass":"ShouldNotHappenException","httpStatus":null,"severity":"error","filePath":"rules/TypeDeclarationDocblocks/Rector/ClassMethod/AddParamArrayDocblockFromDataProviderRector.php","lineNumber":71,"sourceCode":"        yield [['Tom', 'John']];\n    }\n}\nCODE_SAMPLE\n)]);\n    }\n    /**\n     * @return array<class-string<Node>>\n     */\n    public function getNodeTypes(): array\n    {\n        return [Class_::class];\n    }\n    /**\n     * @param Class_ $node\n     */\n    public function refactor(Node $node): ?Node\n    {\n        throw new ShouldNotHappenException(sprintf('\"%s\" is deprecated, as data provider docblock typing is not relevant to code quality', self::class));\n    }\n}\n","sourceCodeStart":53,"sourceCodeEnd":74,"githubUrl":"https://github.com/rectorphp/rector/blob/408fcb0ff1833e3d26cbc9b04c23a77565814a16/rules/TypeDeclarationDocblocks/Rector/ClassMethod/AddParamArrayDocblockFromDataProviderRector.php#L53-L74","documentation":"Rector\\TypeDeclarationDocblocks\\Rector\\ClassMethod\\AddParamArrayDocblockFromDataProviderRector is deprecated: refactor() throws Rector\\Exception\\ShouldNotHappenException on the first Class_ node. The rule added @param array<...> typing to PHPUnit test methods fed by @dataProvider methods, but how a test's parameters are typed has no effect on production code quality, so the generated docblocks were noise.","triggerScenarios":"The rule is still listed in rector.php and rector visits any class (typically a PHPUnit test case); refactor() throws on the first Class_ node.","commonSituations":"Bulk rule lists built to 'type everything'; CI failing on the first test class after a rector upgrade; test-suite configs kept separate that still reference the rule.","solutions":["Remove AddParamArrayDocblockFromDataProviderRector from rector.php.","If a specific test benefits from a @param docblock, add it manually.","Keep provider typing conventions in your test style guide rather than automating them."],"exampleFix":"// before (rector.php)\n->withRules([AddParamArrayDocblockFromDataProviderRector::class])\n\n// after (rector.php) - rule removed; no replacement needed","handlingStrategy":"validation","validationCode":"use Rector\\TypeDeclarationDocblocks\\Rector\\ClassMethod\\AddParamArrayDocblockFromDataProviderRector;\n\n$rules = [/* your list */ AddParamArrayDocblockFromDataProviderRector::class];\nif (in_array(AddParamArrayDocblockFromDataProviderRector::class, $rules, true)) {\n    throw new InvalidArgumentException('Rule deprecated; data-provider typing is not a code-quality concern');\n}","typeGuard":null,"tryCatchPattern":"try {\n    exit($rectorApplication->run());\n} catch (\\Rector\\Exception\\ShouldNotHappenException $e) {\n    if (str_contains($e->getMessage(), 'AddParamArrayDocblockFromDataProviderRector')) {\n        fwrite(STDERR, 'Remove the rule; it only churned PHPUnit test files.' . PHP_EOL);\n        exit(1);\n    }\n    throw $e;\n}","preventionTips":["Scope rector runs for test dirs to rules that matter (e.g. constructor removal, rename), not docblock typing.","Document provider conventions once in the test style guide.","Delete deprecated data-provider docblock rules from configs as part of every rector upgrade."],"tags":["rector","php","phpunit","data-provider","docblock","deprecated-rule"],"backgroundTag":"deprecated-api-invoked","analyzedSha":"408fcb0ff1833e3d26cbc9b04c23a77565814a16","analyzedAt":"2026-08-21T05:11:02.643Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}