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
1 change: 1 addition & 0 deletions .github/workflows/packages_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
# must be repository name, e.g. https://github.com/rectorphp/rector-symfony
- rectorphp/rector-symfony
- rectorphp/rector-phpunit
- rectorphp/rector-pest
- rectorphp/rector-doctrine
- rectorphp/rector-downgrade-php
actions:
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Project-specific conventions for `rector/rector-src`. See `CONTRIBUTING.md` for

- PHP `^8.4` required. Do not use syntax that breaks on 8.4.
- The package is `rector/rector-src`; it `replace`s `rector/rector`.
- Sibling extension packages (`rector-doctrine`, `rector-symfony`, `rector-phpunit`, `rector-downgrade-php`) are pulled in as `dev-main`.
- Sibling extension packages (`rector-doctrine`, `rector-symfony`, `rector-phpunit`, `rector-pest`, `rector-downgrade-php`) are pulled in as `dev-main`.

## Layout

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ This project adheres to a [Contributor Code of Conduct](/CODE_OF_CONDUCT.md) By
* ![](https://github.com/rectorphp/rector-phpunit/actions/workflows/tests.yaml/badge.svg)
![](https://github.com/rectorphp/rector-phpunit/actions/workflows/code_analysis.yaml/badge.svg)

**Pest** - https://github.com/rectorphp/rector-pest

* ![](https://github.com/rectorphp/rector-pest/actions/workflows/code_analysis.yaml/badge.svg)

**Doctrine** - https://github.com/rectorphp/rector-doctrine

* ![](https://github.com/rectorphp/rector-doctrine/actions/workflows/tests.yaml/badge.svg)
Expand Down
1 change: 1 addition & 0 deletions build/target-repository/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"conflict": {
"rector/rector-phpunit": "*",
"rector/rector-pest": "*",
"rector/rector-symfony": "*",
"rector/rector-doctrine": "*",
"rector/rector-downgrade-php": "*"
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"rector/extension-installer": "^0.11.2",
"rector/rector-doctrine": "dev-main",
"rector/rector-downgrade-php": "dev-main",
"rector/rector-pest": "dev-main",
"rector/rector-phpunit": "dev-main",
"rector/rector-symfony": "dev-main",
"sebastian/diff": "^9.0",
Expand Down Expand Up @@ -107,7 +108,7 @@
"rector": "bin/rector process --ansi",
"duplicated-code": "vendor/bin/swiss-knife duplicated-code src rules --min-tokens 150 --min-lines 5",
"preload": "php build/build-preload.php .",
"release": "vendor/bin/rng --from-commit X --to-commit Y --remote-repository rectorphp/rector-symfony --remote-repository rectorphp/rector-doctrine --remote-repository rectorphp/rector-phpunit"
"release": "vendor/bin/rng --from-commit X --to-commit Y --remote-repository rectorphp/rector-symfony --remote-repository rectorphp/rector-doctrine --remote-repository rectorphp/rector-phpunit --remote-repository rectorphp/rector-pest"
},
"config": {
"sort-packages": true,
Expand Down
13 changes: 11 additions & 2 deletions scripts/generate-composer-based-trigger-packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
use Rector\Config\RectorConfig;
use Rector\Configuration\Option;
use Rector\Configuration\Parameter\SimpleParameterProvider;
use Rector\Configuration\RectorConfigBuilder;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Pest\Set\PestSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\Symfony\Set\TwigSetList;
Expand All @@ -21,14 +23,14 @@
'twig' => TwigSetList::COMPOSER_BASED,
'doctrine' => DoctrineSetList::COMPOSER_BASED,
'phpunit' => PHPUnitSetList::COMPOSER_BASED,
'pest' => PestSetList::COMPOSER_BASED,
'symfony' => SymfonySetList::COMPOSER_BASED,
];

// rector-laravel, drupal-rector and rector-pest are not required here, so their sets cannot be read
// rector-laravel and drupal-rector 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 Expand Up @@ -86,6 +88,13 @@

$triggerPackages = array_merge($triggerPackages, $extensionTriggerPackages);

// keep the order of withComposerBased() arguments
$argumentNames = array_map(
static fn (ReflectionParameter $reflectionParameter): string => $reflectionParameter->getName(),
new ReflectionMethod(RectorConfigBuilder::class, 'withComposerBased')->getParameters()
);
$triggerPackages = array_merge(array_intersect_key(array_fill_keys($argumentNames, []), $triggerPackages), $triggerPackages);

$printedTriggerPackages = '';
foreach ($triggerPackages as $argumentName => $packageNames) {
$printedTriggerPackages .= sprintf(" '%s' => [\n", $argumentName);
Expand Down
4 changes: 3 additions & 1 deletion scripts/list-non-composer-based-rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@

require __DIR__ . '/../vendor/autoload.php';

// 1. find all rector rules in doctrine, phpunit and symfony packages; core rules are not package-version bound
// 1. find all rector rules in doctrine, phpunit, pest and symfony packages; core rules are not package-version bound
$rectorClassFinder = new RectorClassFinder();

$rectorClasses = $rectorClassFinder->find([
__DIR__ . '/../vendor/rector/rector-doctrine',
__DIR__ . '/../vendor/rector/rector-phpunit',
__DIR__ . '/../vendor/rector/rector-pest',
__DIR__ . '/../vendor/rector/rector-symfony',
]);

Expand All @@ -29,6 +30,7 @@
__DIR__ . '/../vendor/rector/rector-symfony/config/sets',
__DIR__ . '/../vendor/rector/rector-doctrine/config/sets',
__DIR__ . '/../vendor/rector/rector-phpunit/config/sets',
__DIR__ . '/../vendor/rector/rector-pest/config/sets',
]);

$composerBasedSetFiles = array_filter(
Expand Down
2 changes: 2 additions & 0 deletions scripts/list-unused-rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
__DIR__ . '/../rules',
__DIR__ . '/../vendor/rector/rector-doctrine',
__DIR__ . '/../vendor/rector/rector-phpunit',
__DIR__ . '/../vendor/rector/rector-pest',
__DIR__ . '/../vendor/rector/rector-symfony',
__DIR__ . '/../vendor/rector/rector-downgrade-php',
]);
Expand All @@ -33,6 +34,7 @@
__DIR__ . '/../vendor/rector/rector-symfony/config/sets',
__DIR__ . '/../vendor/rector/rector-doctrine/config/sets',
__DIR__ . '/../vendor/rector/rector-phpunit/config/sets',
__DIR__ . '/../vendor/rector/rector-pest/config/sets',
__DIR__ . '/../vendor/rector/rector-downgrade-php/config/set',
]);

Expand Down
1 change: 1 addition & 0 deletions scripts/unique-rector-short-class-name.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
__DIR__ . '/../rules',
__DIR__ . '/../vendor/rector/rector-doctrine',
__DIR__ . '/../vendor/rector/rector-phpunit',
__DIR__ . '/../vendor/rector/rector-pest',
__DIR__ . '/../vendor/rector/rector-symfony',
__DIR__ . '/../vendor/rector/rector-downgrade-php',
]);
Expand Down
3 changes: 2 additions & 1 deletion src/Configuration/RectorConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,8 @@ public function withComposerBased(
$this->sets[] = DrupalSetList::COMPOSER_BASED;
}

if ($pest && class_exists('Rector\Pest\Set\PestSetList') && constant('Rector\Pest\Set\PestSetList::COMPOSER_BASED')) {
if ($pest) {
// single set, as every rule inside is bound to the installed Pest version on its own
$this->sets[] = PestSetList::COMPOSER_BASED;
}

Expand Down
Loading