You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/update_and_migration/from_4.6/update_to_5.0.md
+30-10Lines changed: 30 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -415,16 +415,6 @@ use Rector\Symfony\Set\SensiolabsSetList;
415
415
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
416
416
SensiolabsSetList::ANNOTATIONS_TO_ATTRIBUTES,
417
417
]
418
-
);
419
-
```
420
-
421
-
But you can also go faster with bigger [rule sets in the modern way](https://getrector.com/documentation/set-lists) like in the following example:
422
-
423
-
```php
424
-
->withSets(
425
-
[
426
-
IbexaSetList::IBEXA_50->value // rule set for upgrading to Ibexa DXP 5.0
427
-
]
428
418
)
429
419
->withPhpSets()
430
420
->withComposerBased(twig: true, symfony: true)
@@ -445,6 +435,36 @@ But you can also go faster with bigger [rule sets in the modern way](https://get
445
435
);
446
436
```
447
437
438
+
TODO: Among other things, the type hinting strictness has been increased.
439
+
440
+
TODO: `AsCommand` attribute; Rector doesn't move `parent::__construct('app:test');` into `AsCommand`?
441
+
442
+
In the following example, you can see optimization thanks to the following features:
443
+
444
+
-[Constructor parameter promoted as properties](https://www.php.net/manual/en/language.oop5.decon.php#language.oop5.decon.constructor.promotion) (available since PHP 8.0)
445
+
-[`AsCommand` attribute to register a command](https://symfony.com/doc/7.2/console.html#console_registering-the-command) (available since Symfony 6.2)
446
+
447
+
```diff
448
+
+#[AsCommand(name: 'app:test', description: 'Command to test something.')]
449
+
class TestCommand extends Command
450
+
{
451
+
- private Repository $repository;
452
+
-
453
+
- public function __construct(Repository $repository)
454
+
+ public function __construct(private readonly Repository $repository)
455
+
{
456
+
- $this->repository = $repository;
457
+
- parent::__construct('app:test');
458
+
}
459
+
-
460
+
- protected function configure()
461
+
- {
462
+
- $this->setDescription('Command to test something.');
463
+
- }
464
+
465
+
protected function execute(InputInterface $input, OutputInterface $output): int
0 commit comments