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.
Bug Report
The RemoveUnusedConstructorParamRector removes parameters that are required by an interface contract.
Minimal PHP Code Causing Issue
The RemoveUnusedConstructorParamRector will remove the $config parameter in
RectorClassresulting in an invalid method signature.Expected Behaviour
Rector should not remove parameters required by interfaces.