Skip to content

Conversation

@samsonasik
Copy link
Member

Closes #3085

mttsch and others added 3 commits November 23, 2022 06:05
@samsonasik
Copy link
Member Author

It seems cause error on DowngradeSelfTypeDeclarationRector:

 2) Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\DowngradeSelfTypeDeclarationRectorTest::test with data set #1 ('/home/runner/work/rector-src/...hp.inc')
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
 
 class Fixture
 {
-    /**
-     * @return $this
-     */
-    public function getSelf()
+    public function getSelf(): self
     {
         return $this;
     }

The at least php version check possibly needed.

@samsonasik samsonasik marked this pull request as draft November 22, 2022 23:36
@samsonasik
Copy link
Member Author

samsonasik commented Nov 23, 2022

@TomasVotruba the patch seems needs to be in both here and rector-downgrade-php's PhpDocFromTypeDeclarationDecorator::decorateReturnWithSpecificType() which verify SelfStaticType

https://github.com/rectorphp/rector-downgrade-php/blob/d5a52d643513c66fc23270aa4748a564508ccc1d/src/PhpDocDecorator/PhpDocFromTypeDeclarationDecorator.php#L155

due to the mapper used in both:

  • rector-src
  • rector-downgrade-php

@samsonasik
Copy link
Member Author

samsonasik commented Nov 23, 2022

@TomasVotruba I created PR to rector-downgrade-php that required for it:

that need to be merged first before this.

@samsonasik samsonasik marked this pull request as ready for review November 23, 2022 01:45
@samsonasik samsonasik changed the title [TypeDeclaration] Handle return self on TypedPropertyFromStrictGetterMethodReturnTypeRector no php 8.0 feature enabled [TypeDeclaration] Handle return self on TypedPropertyFromStrictGetterMethodReturnTypeRector on php 8.0 feature enabled Nov 23, 2022
@samsonasik
Copy link
Member Author

Build restarted

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I think it is ready.

@samsonasik
Copy link
Member Author

Let's merge and verify scoped build

@samsonasik samsonasik merged commit 335d593 into main Nov 23, 2022
@samsonasik samsonasik deleted the patch-1 branch November 23, 2022 09:56
@samsonasik
Copy link
Member Author

samsonasik commented Nov 23, 2022

@TomasVotruba it works 🎉

Screen Shot 2022-11-23 at 17 15 13

@TomasVotruba
Copy link
Member

Thank you 👏

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.

5 participants