-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrector.php
More file actions
33 lines (30 loc) · 2.47 KB
/
Copy pathrector.php
File metadata and controls
33 lines (30 loc) · 2.47 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
<?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 bundle and the applications installing it are then held to one and the same standard, and neither can drift ahead of the other
// 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__ . '/src',
__DIR__ . '/tests',
])
->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; and 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,
]);