Skip to content

Commit 8cec138

Browse files
committed
update_to_5.0.md: Continue Rector exploration
1 parent 94ba3e2 commit 8cec138

File tree

1 file changed

+31
-12
lines changed

1 file changed

+31
-12
lines changed

docs/update_and_migration/from_4.6/update_to_5.0.md

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ It supports only PHP 8.3 and above.
2727

2828
If your DXP 4.6 is running on a PHP below 8.3, start migrating it to PHP 8.3.
2929

30+
//TODO: Update composer.json require.php to help Rector find out the right PHP version your project is using
31+
32+
//IbexaSetList::IBEXA_46->value is only about Ibexa, add some PHP rule set
33+
3034
Use Ibexa Rector to help yourself to upgrade PHP code for 8.3,
3135
see [`ibexa/rector`'s README](https://github.com/ibexa/rector?tab=readme-ov-file#ibexa-dxp-rector)
3236
and [Rector's documentation](https://getrector.com/documentation)
@@ -351,16 +355,17 @@ php bin/console ibexa:graphql:generate-schema
351355

352356
#### Update PHP framework standards
353357

354-
Update the `rector.php` file to use `IbexaSetList::IBEXA_50` rule set
355-
by running its recipe:
358+
Update the `rector.php` file to use `IbexaSetList::IBEXA_50` rule set.
359+
If you didn't edit it the first time, you can run its recipe:
356360

357361
```bash
358362
composer recipe:install ibexa/rector --force --reset --yes
359363
```
360364

361365
You can add some other rule sets (like, for example, the Symfony ones) to match newer standards.
362366

363-
It's recommended to activate one set at a time, check the output, and decide if kept right now, or discarded for another time.
367+
It's recommended to activate one set at a time, run a first time with the `--dry-run` option,
368+
check the output, and decide if kept right now, or discarded for another time.
364369

365370
```php
366371
//…
@@ -370,14 +375,15 @@ use Rector\Symfony\Set\SensiolabsSetList;
370375
->withSets(
371376
[
372377
IbexaSetList::IBEXA_50->value,
373-
SymfonySetList::SYMFONY_60,
374-
SymfonySetList::SYMFONY_61,
375-
SymfonySetList::SYMFONY_62,
376-
SymfonySetList::SYMFONY_63,
377-
SymfonySetList::SYMFONY_64,
378-
SymfonySetList::SYMFONY_70,
379-
SymfonySetList::SYMFONY_71,
380-
SymfonySetList::SYMFONY_72,
378+
SymfonySetList::SYMFONY_60, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-symfonysymfony-60
379+
SymfonySetList::SYMFONY_61, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-symfonysymfony-61
380+
SymfonySetList::SYMFONY_62, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-symfonysymfony-62
381+
SymfonySetList::SYMFONY_63, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-symfonysymfony-63
382+
SymfonySetList::SYMFONY_64, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-symfonysymfony-64
383+
SymfonySetList::SYMFONY_70, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-symfonysymfony-70
384+
SymfonySetList::SYMFONY_71, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-symfonysymfony-71
385+
SymfonySetList::SYMFONY_72, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-symfonysymfony-72
386+
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
381387
SensiolabsSetList::ANNOTATIONS_TO_ATTRIBUTES,
382388
]
383389
);
@@ -394,7 +400,20 @@ But you can also go faster with bigger [rule sets in the modern way](https://get
394400
->withPhpSets()
395401
->withComposerBased(twig: true, symfony: true)
396402
->withAttributesSets(symfony: true, sensiolabs: true)
397-
;
403+
->withPreparedSets(
404+
deadCode: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-dead-code
405+
codeQuality: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-code-quality
406+
codingStyle: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-coding-style
407+
typeDeclarations: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-type-declarations
408+
// privatization: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-privatization
409+
naming: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-naming
410+
instanceOf: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-instanceof
411+
earlyReturn: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-early-return
412+
// strictBooleans: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-strict-booleans
413+
rectorPreset: true,
414+
symfonyCodeQuality: true, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-code-quality
415+
symfonyConfigs: true, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-configs
416+
);
398417
```
399418

400419
#### Update field type identifiers

0 commit comments

Comments
 (0)