Skip to content

[TypeDeclaration] Add nullable return $this on ReturnUnionTypeRector#4891

Closed
samsonasik wants to merge 7 commits intomainfrom
nn
Closed

[TypeDeclaration] Add nullable return $this on ReturnUnionTypeRector#4891
samsonasik wants to merge 7 commits intomainfrom
nn

Conversation

@samsonasik
Copy link
Copy Markdown
Member

@staabm here for the nullable return new self on ReturnUnionTypeRector

@samsonasik samsonasik changed the title [TypeDeclaration] Add nullable return self on ReturnUnionTypeRector [TypeDeclaration] Add nullable return $this on ReturnUnionTypeRector Aug 31, 2023
Comment on lines +64 to +66
if ($type instanceof ThisType) {
return new Name(ObjectReference::SELF);
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@staabm this will make add self to return even on non-final class => ?self on use return $this, so it can downgrade the functionality.

I guess we need another "special fixer rule" to change "self" to "static" when possible (depends on php version)

so this change need more consideration :)

@samsonasik
Copy link
Copy Markdown
Member Author

I am closing for now.

@samsonasik samsonasik closed this Aug 31, 2023
@samsonasik samsonasik deleted the nn branch August 31, 2023 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants