-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Experiment][TypeDeclaration] Allow change abstract class methods with body on ReturnType*Rector #5344
Conversation
… on ReturnType*Rector
For change in vendor + non-vendor location, it already verified on |
All checks have passed 🎉 @TomasVotruba @staabm it is ready for review. |
Ok, It seems it will cause a bug on union: abstract class SomeAbstractWithUnion
{
public function run()
{
if (rand(0, 1)) {
return null;
}
return new \DateTime;
}
}
final class NullableUnion extends SomeAbstractWithUnion
{
public function run()
{
if (rand(0, 1)) {
return null;
}
return new stdClass;
}
} it got: abstract class SomeAbstractWithUnion
{
- public function run()
+ public function run(): ?\DateTime
{
if (rand(0, 1)) {
return null;
@@ @@
final class NullableUnion extends SomeAbstractWithUnion
{
- public function run()
+ public function run(): ?\stdClass
{
if (rand(0, 1)) {
return null; on union type, it specifically on child verification tho, nothing todo with abstract, I will check in separate PR. |
Oh, it seems fine, it because I wrongly copy paste class name, I will add the fixture |
Added more fixtures :), Ready to review 👍 |
Ok, interface never have method with body, so I guess it can be rolled back for performance reason to skip it. |
@@ -45,7 +45,7 @@ public function shouldSkipClassMethod(ClassMethod $classMethod, Scope $scope): b | |||
return true; | |||
} | |||
|
|||
if ($classReflection->isAbstract()) { | |||
if ($classMethod->isAbstract()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is skip only on abstract method only, not abstract class 👍
@samsonasik Feel free to go for merge, let's try this in real world 😉 |
Ok, let's merge it ;) |
@TomasVotruba @staabm based on child return type sub type verification on previous PR:
This is experiment to allow abstract class methods with body to make return type as well on
ClassMethodReturnTypeOverrideGuard
service.