-
-
Notifications
You must be signed in to change notification settings - Fork 740
Closed
rectorphp/rector-src
#5778Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | 0.19.1 |
The RemoveUnusedConstructorParamRector removes parameters that are required by an interface contract.
Minimal PHP Code Causing Issue
<?php
Interface RectorTest {
public function __construct(string $name, array $config);
}
abstract class RectorClass implements RectorTest {
protected $name;
public function __construct(string $name, array $config) {
$this->name = $name;
}
}
class Rector extends RectorClass {
public function __construct(string $name, array $config) {
parent::__construct($name, $config);
if($config['type'] == 'a') {
echo 'a';
}
}
}The RemoveUnusedConstructorParamRector will remove the $config parameter in RectorClass resulting in an invalid method signature.
Expected Behaviour
Rector should not remove parameters required by interfaces.
Reactions are currently unavailable