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
{{ message }}
Repository navigation
withComposerBased() fatals on Drupal projects: RectorPrefix…\DrupalRector\Set\DrupalSetList not found #9950
When working on palantirnet/drupal-rector#419 I was chasing why it sometimes crashes and I couldnt work around some versions for the DrupalSetList. This was the analysis of it:
On a Drupal project with palantirnet/drupal-rector installed, the drupal toggle crashes at config load, before any file is processed:
[ERROR] Class "RectorPrefix202610\DrupalRector\Set\DrupalSetList" not found
Since 2.8.2, drupal/core is in ComposerBasedTriggerPackages, so a bare withComposerBased() turns on drupal: true automatically and hits the same crash.
Minimal PHP Code Causing Issue
<?phpuseRector\Config\RectorConfig;
returnRectorConfig::configure()
->withPaths([__DIR__ . '/web/modules/custom'])
->withComposerBased(); // or ->withComposerBased(drupal: true)
Steps: Drupal 11 site, composer require --dev rector/rector:2.8.3 palantirnet/drupal-rector:dev-composer-based-set (the branch of palantirnet/drupal-rector#419 that adds DrupalSetList::COMPOSER_BASED), then run vendor/bin/rector process --dry-run.
Cause
src/Configuration/RectorConfigBuilder.php:
useDrupalRector\Set\DrupalSetList; // line 7// ...if ($drupal && class_exists('DrupalRector\Set\DrupalSetList') && constant('DrupalRector\Set\DrupalSetList::COMPOSER_BASED')) {
$this->sets[] = DrupalSetList::COMPOSER_BASED; // line 692
}
The string checks are left alone, but php-scoper prefixes the use import. scoper.php excludes #^Rector# (which is why RectorLaravel\… works) but not DrupalRector. Running from a rector-src checkout isn't scoped, so tests don't catch it.
Expected Behaviour
DrupalSetList::COMPOSER_BASED loads. Either fix works:
add '#^DrupalRector#' to exclude-namespaces in scoper.php, or
use $this->sets[] = constant('DrupalRector\Set\DrupalSetList::COMPOSER_BASED'); and drop the use import.
Activity
samsonasik commentedon Oct 30, 2026
I see, the
'#^Rector#',includes
RectorLaravel, but notDrupalRector.Could you create PR for it? Thank you.
samsonasik commentedon Oct 30, 2026
handled at rectorphp/rector-src#8897
bbrala commentedon Oct 30, 2026
<3 i love you