{"record":{"id":"847bed00902077aa","repo":"rectorphp/rector","slug":"s-is-deprecated-as-data-provider-docblock-typi-847bed","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/Class_/AddReturnDocblockDataProviderRector.php","lineNumber":76,"sourceCode":"     * @return array<array<string>>\n     */\n    public function provideItems()\n    {\n        return [\n            [['item1', 'item2']],\n            [['item3', 'item4']],\n        ];\n    }\n}\nCODE_SAMPLE\n)]);\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":58,"sourceCodeEnd":79,"githubUrl":"https://github.com/rectorphp/rector/blob/408fcb0ff1833e3d26cbc9b04c23a77565814a16/rules/TypeDeclarationDocblocks/Rector/Class_/AddReturnDocblockDataProviderRector.php#L58-L79","documentation":"Rector\\TypeDeclarationDocblocks\\Rector\\Class_\\AddReturnDocblockDataProviderRector is deprecated: refactor() throws Rector\\Exception\\ShouldNotHappenException on the first Class_ node. It added @return docblocks to PHPUnit data-provider methods, which - like its sibling rules - is typing that never affects code quality and only adds churn to test files.","triggerScenarios":"The rule is still referenced in rector.php and rector visits any class declaration; refactor() throws on the first Class_ node of the run.","commonSituations":"Copied 'full typing' rule bundles; CI failing immediately after upgrading rector past the removal; separate rector configs for test directories that still list the rule.","solutions":["Remove AddReturnDocblockDataProviderRector from rector.php.","Add provider @return docblocks by hand only where a reader benefits.","Track provider conventions in review checklists instead of automated rewrites."],"exampleFix":"// before (rector.php)\n->withRules([AddReturnDocblockDataProviderRector::class])\n\n// after (rector.php) - rule removed; no replacement needed","handlingStrategy":"validation","validationCode":"use Rector\\TypeDeclarationDocblocks\\Rector\\Class_\\AddReturnDocblockDataProviderRector;\n\n$rules = [/* your list */ AddReturnDocblockDataProviderRector::class];\nif (in_array(AddReturnDocblockDataProviderRector::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(), 'AddReturnDocblockDataProviderRector')) {\n        fwrite(STDERR, 'Remove the rule; type providers by hand only where a reader benefits.' . PHP_EOL);\n        exit(1);\n    }\n    throw $e;\n}","preventionTips":["Maintain a project allowlist of rector rules and validate it against rector's current rule set on upgrade.","Skip docblock-generation rules for PHPUnit code entirely - the provider family was deprecated as noise.","Fail CI early on deprecated class names in rector.php so one stale entry cannot break every run."],"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"}