Bug Report
| Subject |
Details |
| Rector version |
0.8.56, demo ver ? |
| Installed as |
composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.org/demo/9cba5a13-fa55-4f06-880a-ccdd8259db78
<?php
class DemoFile
{
public function run()
{
throw new Exception("not implemented");
}
}
class DemoFile2 extends DemoFile {
public function run() : Baba {
return new Baba();
}
}
class Baba {
}
Rector diff:
class DemoFile2 extends DemoFile {
- public function run() : Baba {
+ public function run() : void {
return new Baba();
}
}
class Baba {
}
Responsible rules
ReturnTypeDeclarationRector
Expected Behavior
Should be skipped.
In my own code it has a little bit different behaviour for some reason: it does add : void to the throwing function as a return type, which makes the code screaming about compatibility between the overriden function.
Bug Report
Minimal PHP Code Causing Issue
See https://getrector.org/demo/9cba5a13-fa55-4f06-880a-ccdd8259db78
Rector diff:
class DemoFile2 extends DemoFile { - public function run() : Baba { + public function run() : void { return new Baba(); } } class Baba { }Responsible rules
ReturnTypeDeclarationRectorExpected Behavior
Should be skipped.
In my own code it has a little bit different behaviour for some reason: it does add
: voidto the throwing function as a return type, which makes the code screaming about compatibility between the overriden function.