-
-
Notifications
You must be signed in to change notification settings - Fork 737
Closed
Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | v2.0.12 (invoke vendor/bin/rector --version) |
RenamePropertyToMatchTypeRector is renaming public properties, which should be avoided as they are part of the public API.
Minimal PHP Code Causing Issue
<?php
declare(strict_types=1);
namespace App\Domain;
use App\Domain\Common\PositiveInteger;
final readonly class Example
{
public function __construct(
public PositiveInteger $used,
) {}
}After running Rector with RenamePropertyToMatchTypeRector:
public function __construct(
- public PositiveInteger $used,
+ public PositiveInteger $positiveInteger,
) {}Expected Behaviour
RenamePropertyToMatchTypeRector should skip public properties as they're part of the public API, and renaming them could break dependent code. The rule should only apply to private and protected properties.
GitHub issue #7672 suggested this behavior is already implemented, but it doesn't seem to work in the current version.