{"record":{"id":"62a82dcfde3e943a","repo":"rectorphp/rector","slug":"the-s-method-is-deprecated-and-no-longer-ap","errorCode":null,"errorMessage":"The \"->%s()\" method is deprecated and no longer applied. Use \"->withPhpLevel()\" instead, to raise PHP level one rule at a time.","messagePattern":"The \"->(.+?)\\(\\)\" method is deprecated and no longer applied\\. Use \"->withPhpLevel\\(\\)\" instead, to raise PHP level one rule at a time\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/Reporting/DeprecatedRulesReporter.php","lineNumber":67,"sourceCode":"                continue;\n            }\n            $this->symfonyStyle->warning(sprintf('Skipped rule \"%s\" is deprecated', $skippedRectorRule));\n        }\n    }\n    public function reportDeprecatedCacheMetaExtensions(): void\n    {\n        /** @var string[] $cacheMetaExtensions */\n        $cacheMetaExtensions = SimpleParameterProvider::provideArrayParameter(Option::CACHE_META_EXTENSIONS);\n        foreach ($cacheMetaExtensions as $cacheMetumExtension) {\n            $this->symfonyStyle->warning(sprintf('Cache meta extension \"%s\" is deprecated and no longer applied. It is a niche mechanism, let Rector handle cache on its own. If custom invalidation is needed, handle it in CI in a more generic way, e.g. by clearing the cache directory.', $cacheMetumExtension));\n        }\n    }\n    public function reportDeprecatedPhpSetsMethods(): void\n    {\n        /** @var string[] $deprecatedPhpSetsMethods */\n        $deprecatedPhpSetsMethods = SimpleParameterProvider::provideArrayParameter(Option::DEPRECATED_PHP_SETS_METHODS);\n        foreach (array_unique($deprecatedPhpSetsMethods) as $deprecatedPhpSetsMethod) {\n            $this->symfonyStyle->warning(sprintf('The \"->%s()\" method is deprecated and no longer applied. Use \"->withPhpLevel()\" instead, to raise PHP level one rule at a time.', $deprecatedPhpSetsMethod));\n        }\n    }\n    public function reportDeprecatedAttributesSetsArgs(): void\n    {\n        /** @var string[] $deprecatedAttributesSetsArgs */\n        $deprecatedAttributesSetsArgs = SimpleParameterProvider::provideArrayParameter(Option::DEPRECATED_ATTRIBUTES_SETS_ARGS);\n        foreach (array_unique($deprecatedAttributesSetsArgs) as $deprecatedAttributesSetsArg) {\n            $this->symfonyStyle->warning(sprintf('The \"->withAttributesSets(%s: true)\" argument is deprecated and no longer applied. It is already included in the \"symfony: true\" argument, use it instead.', $deprecatedAttributesSetsArg));\n        }\n    }\n    public function reportDeprecatedComposerBasedArgs(): void\n    {\n        /** @var string[] $deprecatedComposerBasedArgs */\n        $deprecatedComposerBasedArgs = SimpleParameterProvider::provideArrayParameter(Option::DEPRECATED_COMPOSER_BASED_ARGS);\n        foreach (array_unique($deprecatedComposerBasedArgs) as $deprecatedComposerBasedArg) {\n            $this->symfonyStyle->warning(sprintf('The \"->withComposerBased(%s: true)\" argument is deprecated and no longer applied. It only added named args to 2 methods of a single package, register the rule directly if needed.', $deprecatedComposerBasedArg));\n        }\n    }","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/rectorphp/rector/blob/408fcb0ff1833e3d26cbc9b04c23a77565814a16/src/Reporting/DeprecatedRulesReporter.php#L49-L85","documentation":"This is a deprecation warning (printed via SymfonyStyle->warning, not an exception) emitted during a Rector run. The fluent config builder methods withPhp53Sets() through withPhp74Sets() no longer register any rules; calling them only records the method name (RectorConfigBuilder::reportDeprecatedPhpSetsMethod(), src/Configuration/RectorConfigBuilder.php:427-462) and at run time DeprecatedRulesReporter::reportDeprecatedPhpSetsMethods() prints this warning. Rector wants explicit per-version sets replaced by withPhpLevel()/withPhpSets(), which pick the target PHP level (from composer.json by default) instead of hard-coding a legacy version.","triggerScenarios":"Calling ->withPhp53Sets(), withPhp54Sets(), withPhp55Sets(), withPhp56Sets(), withPhp70Sets(), withPhp71Sets(), withPhp72Sets(), withPhp73Sets() or withPhp74Sets() on the RectorConfigBuilder fluent chain in rector.php; the run starts normally but prints this warning block and those methods apply zero rules (so legacy-version downgrades/upgrade rules are silently NOT run).","commonSituations":"Projects on rector ^1.x (or rector-src 2.x) that still carry withPhpXXSets() calls from an older config recipe; teams noticing that PHP 5.x/7.x compatibility rules stopped applying after an upgrade and finding this warning in CI output; upgrading rector/downgrade-mirror tooling where old configs get copied forward.","solutions":["Replace the deprecated call: use ->withPhpLevel(PhpVersion::PHP_74) (or the level you targeted) so the exact set for that version is loaded again; add one withPhpLevel() per level if you previously stacked several withPhpXXSets() calls.","Better: call ->withPhpSets() with no arguments so Rector derives the target PHP version from your composer.json require.php and stays current automatically.","Remove the dead withPhpXXSets() lines entirely - keeping them does nothing (they register no rules) and only produces the warning.","After the change, run `vendor/bin/rector process --dry-run` on a sample directory and diff the rule set (e.g. `vendor/bin/rector list` style dry run output) to confirm the expected level rules now actually apply."],"exampleFix":"// before\nreturn RectorConfigBuilder::create()\n    ->withPaths([__DIR__ . '/src'])\n    ->withPhp74Sets() // deprecated, no rules applied\n    ->withRules([SomeRector::class]);\n\n// after\nuse Rector\\ValueObject\\PhpVersion;\n\nreturn RectorConfigBuilder::create()\n    ->withPaths([__DIR__ . '/src'])\n    ->withPhpLevel(PhpVersion::PHP_74)\n    ->withRules([SomeRector::class]);","handlingStrategy":"validation","validationCode":"// CI pre-flight check: fail before the run if deprecated builder methods are still used\n$configFile = 'rector.php';\n$contents = file_get_contents($configFile);\nforeach (['withPhp53Sets','withPhp54Sets','withPhp55Sets','withPhp56Sets','withPhp70Sets','withPhp71Sets','withPhp72Sets','withPhp73Sets','withPhp74Sets'] as $deprecatedMethod) {\n    if (str_contains($contents, $deprecatedMethod)) {\n        fwrite(STDERR, \"rector.php uses deprecated builder {$deprecatedMethod}() - replace with withPhpLevel()/withPhpSets()\\n\");\n        exit(1);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer ->withPhpSets() with no arguments (level from composer.json) over hard-coded versions, so config never needs per-version methods.","When copying Rector config recipes, check them against the version you install: withPhpXXSets() calls are pre-2.x style.","Watch Rector's own output blocks during upgrades - warnings like this one are printed before diffs and indicate rules that silently stopped applying."],"tags":["rector","deprecation","php-sets","config-builder","php"],"backgroundTag":"deprecated-config-method","analyzedSha":"408fcb0ff1833e3d26cbc9b04c23a77565814a16","analyzedAt":"2026-08-21T05:11:02.643Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}