-
-
Notifications
You must be signed in to change notification settings - Fork 737
Closed
rectorphp/rector-src
#6992Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/c4c1b0c6-74f7-4487-ab78-a7943e090797
<?php
trait DemoTrait {
private array $values = [];
public function addValue(int $value) {
$this->values[] = $value;
}
}
trait DefaultDemoTrait {
use DemoTrait {
addValue as addAnyValue;
}
public function addValue() {
$this->addAnyValue(0);
}
}Responsible rules
AddParamBasedOnParentClassMethodRector
Expected Behavior
I think Rector should not modify this code. Traits are about composition and not inheritance. It is totally legitimate to rename (and then "overwrite") a method when a trait uses another trait.
Unless there is something I am completely missing here?
marcelfortmann