You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Requiring a pull request to enable every custom SetProvider feels like an unnecessary hurdle for developers who want to extend functionality.
Given current priorities, these feature (ComposerTriggeredSet and Custom Set Provider) will not be pursued further.
Solution:
Revert the configuration back to the old syntax and use the RectorConfig::import() method for importing configurations
use Composer\InstalledVersions and Composer\Semver\VersionParser for filtering
// `config/phpunit/phpunit/phpunit-11.php`<?phpdeclare (strict_types=1);
useComposer\InstalledVersions;
useComposer\Semver\VersionParser;
useRector\Config\RectorConfig;
returnstaticfunction (RectorConfig$rectorConfig) : void {
if (! InstalledVersions::satisfies(newVersionParser, 'phpunit/phpunit', '^11.0') ) {
return;
}
// rules and sets that are imported;// - if the installed version of "phpunit/phpunit" satisfies "^11.0" constraint.$rectorConfig->import(__DIR__ . '/phpunit-10.php');
};
Implement dynamic config imports.
// `config/revamp.php`$phpFiles = [];
// Create a RecursiveDirectoryIterator to iterate through the directory$iterator = newRecursiveIteratorIterator(
newRecursiveDirectoryIterator(__DIR__),
RecursiveIteratorIterator::LEAVES_ONLY// Only files, not directories
);
// Loop through the filesforeach ($iteratoras$file) {
if (! $file->isFile()) {
continue; // Skip directories
}
$realPath = $file->getRealPath();
if (! is_string($realPath)) {
continue; // Skip files that cannot be read
}
if(!str_ends_with($realPath, '.php') ) {
continue; // Skip files that are not PHP files
}
$phpFiles[$realPath] = true; // Add the file's full path to the result array
}
unset($phpFiles[__FILE__]); // Remove this file from the arrayreturn RectorConfig::configure()->withSets(array_keys($phpFiles));
The text was updated successfully, but these errors were encountered:
Following up on: rectorphp/rector#8720 (comment) & rectorphp/rector-src#6515
Requiring a pull request to enable every custom SetProvider feels like an unnecessary hurdle for developers who want to extend functionality.
Given current priorities, these feature (
ComposerTriggeredSet
andCustom Set Provider
) will not be pursued further.Solution:
RectorConfig::import()
method for importing configurationsComposer\InstalledVersions
andComposer\Semver\VersionParser
for filteringThe text was updated successfully, but these errors were encountered: