-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
37 lines (34 loc) · 2.87 KB
/
Copy pathrector.php
File metadata and controls
37 lines (34 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/*
* (c) 2026: 975L <contact@975l.com>
* (c) 2026: Laurent Marquet <laurent.marquet@laposte.net>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
use Rector\Config\RectorConfig;
use Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector;
use Rector\Php82\Rector\Class_\ReadOnlyClassRector;
// The same sets a site gets from SymfonyMigrate.sh, deliberately: the scaffold is copied as is into the applications, where that configuration is what runs over it. Anything this bundle leaves behind is rewritten there, and the rewritten file no longer matches the hash ScaffoldInstaller recorded, so the site is told forever it customized a file it never touched. Hence scaffold/ in the paths below, next to the bundle's own code
// withPhpSets() takes its target from composer.json rather than naming a version here: the bundles and the sites both require ">=8.4", so both resolve to the same rules and neither can drift ahead of the other
// Since Rector 2.6.2 the versioned Symfony sets (SymfonySetList::SYMFONY_XX) no longer exist: withComposerBased() binds every rule to the version of the package actually installed, read from composer.json, so no version has to be renamed here when Symfony moves on
return RectorConfig::configure()
->withPaths([
__DIR__ . '/ConfigBundle/src',
__DIR__ . '/ConfigBundle/tests',
__DIR__ . '/ConfigBundle/scaffold',
__DIR__ . '/UiBundle/src',
__DIR__ . '/UiBundle/tests',
__DIR__ . '/UiBundle/scaffold',
])
->withPhpSets()
// The cache lives in the repository rather than in sys_get_temp_dir(), one directory shared by every repository on the machine: a run here no longer competes with, nor empties, the cache of the other repositories. bin/ci.sh keeps its cold cache by leaving this directory out of the copy
->withCache(cacheDirectory: __DIR__ . '/.rector.cache')
->withComposerBased(symfony: true, doctrine: true)
// Symfony, Doctrine and Sensio annotations turned into attributes: withComposerBased() only brings the version upgrades, and without this set a @Route or an @Assert left in a docblock is a mere comment Symfony 8 ignores
->withAttributesSets(symfony: true, doctrine: true, sensiolabs: true)
// Two rules are dropped rather than followed: a readonly class can only be extended by another readonly one, which closes the door these bundles are built to leave open - a site overriding a service would have to make its own readonly too, and could then no longer hold state of its own; copying a parent's parameters after a variadic $args does not compile, while that variadic is deliberate in the CrudControllers, where it absorbs EasyAdmin's signature changes without the bundle having to follow them
->withSkip([
AddParamBasedOnParentClassMethodRector::class,
ReadOnlyClassRector::class,
]);