Skip to content
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

[TypeDeclaration] Add return static object support on ReturnTypeFromStrictFluentReturnRector #4916

Merged
merged 5 commits into from
Sep 5, 2023

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Sep 5, 2023

@staabm continue of :

This will return static on php 8.x, and return self on php 7.x when it returns new static.

The self return is happen on:

  • anonymous class
  • final class
  • not yet supported (php 7.x)

otherwise, it will return static.

@samsonasik
Copy link
Member Author

Github actions seems has issue showing latest commit, I just committed latest clean up commit but not shown, the change is Ready actually 👍

@samsonasik samsonasik enabled auto-merge (squash) September 5, 2023 16:57
@samsonasik samsonasik merged commit aa72821 into main Sep 5, 2023
@samsonasik samsonasik deleted the return-statuc branch September 5, 2023 17:00
Copy link
Contributor

@staabm staabm left a comment

Choose a reason for hiding this comment

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

Nice 😊

ClassMethod $classMethod,
ClassReflection $classReflection
): ClassMethod {
$classMethod->returnType = $this->shouldSelf($classReflection)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could additionally add static phpdoc type on php7?

Copy link
Member Author

Choose a reason for hiding this comment

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

That seems can be an improvement next 👍 with check not support static, but not final class and not anonymous class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants