Closed
Description
Bug Report
Subject | Details |
---|---|
Rector version | Rector 2.0.10 |
PHP version | 8.4.2 |
Issue
Rector is proposing the following change:
1) src/Bridge/Eloquent/Purger/ModelPurger.php:29
---------- begin diff ----------
@@ @@
use IsAServiceTrait;
private Migrator $migrator;
- private string $migrationPath;
private MigrationRepositoryInterface $repository;
- public function __construct(MigrationRepositoryInterface $repository, string $migrationPath, Migrator $migrator)
+ public function __construct(MigrationRepositoryInterface $repository, private string $migrationPath, Migrator $migrator)
{
$this->migrator = $migrator;
- $this->migrationPath = $migrationPath;
$this->repository = $repository;
}
----------- end diff -----------
Applied rules:
* ClassPropertyAssignToConstructorPromotionRector
The rule applied ClassPropertyAssignToConstructorPromotionRector
looks correct but for some reason it did not apply it to the parameters $repository
and $migrator
.
Reproducer
I could get this error in this PR theofidry/AliceDataFixtures#294 but to narrow down the issue I extracted theofidry/AliceDataFixtures#296.
Expected Behaviour
Rector should propose the following diff instead:
1) src/Bridge/Eloquent/Purger/ModelPurger.php:29
---------- begin diff ----------
@@ @@
use IsAServiceTrait;
- private Migrator $migrator;
- private string $migrationPath;
- private MigrationRepositoryInterface $repository;
- public function __construct(MigrationRepositoryInterface $repository, string $migrationPath, Migrator $migrator)
+ public function __construct(private MigrationRepositoryInterface $repository, private string $migrationPath, private Migrator $migrator)
{
- $this->migrator = $migrator;
- $this->migrationPath = $migrationPath;
- $this->repository = $repository;
}
----------- end diff -----------
Applied rules:
* ClassPropertyAssignToConstructorPromotionRector
Activity