Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/generate-composer-based-trigger-packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
'symfony' => SymfonySetList::COMPOSER_BASED,
];

// rector-laravel and drupal-rector are not required here, so their sets cannot be read
// rector-laravel, drupal-rector and rector-pest are not required here, so their sets cannot be read
$extensionTriggerPackages = [
'laravel' => ['laravel/framework', 'illuminate/support'],
'drupal' => ['drupal/core'],
'pest' => ['pestphp/pest'],
];

$triggerPackages = [];
Expand Down
3 changes: 3 additions & 0 deletions src/Configuration/ComposerBasedTriggerPackages.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,8 @@ final class ComposerBasedTriggerPackages
'drupal' => [
'drupal/core',
],
'pest' => [
'pestphp/pest',
],
];
}
6 changes: 6 additions & 0 deletions src/Configuration/RectorConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Enum\Config\Defaults;
use Rector\Exception\Configuration\InvalidConfigurationException;
use Rector\Pest\Set\PestSetList;
use Rector\Php\PhpVersionResolver\ComposerJsonPhpVersionResolver;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\DowngradeLevelSetList;
Expand Down Expand Up @@ -685,6 +686,7 @@ public function withComposerBased(
bool $netteUtils = false,
bool $laravel = false,
bool $drupal = false,
bool $pest = false,
): self {
if (func_num_args() === 0) {
return $this->withComposerBased(...$this->resolveInstalledComposerBasedPackages());
Expand All @@ -699,6 +701,10 @@ public function withComposerBased(
$this->sets[] = DrupalSetList::COMPOSER_BASED;
}

if ($pest && class_exists('Rector\Pest\Set\PestSetList') && constant('Rector\Pest\Set\PestSetList::COMPOSER_BASED')) {
$this->sets[] = PestSetList::COMPOSER_BASED;
}

if ($phpunit) {
// single set, as every rule inside is bound to the installed PHPUnit version on its own
$this->sets[] = PHPUnitSetList::COMPOSER_BASED;
Expand Down
Loading