Skip to content

[TypeDeclaration] Only apply false type on php 8.2+ configured on TypedPropertyFromAssignsRector#3422

Merged
samsonasik merged 22 commits intomainfrom
only-apply-false-type-on-php82
Feb 28, 2023
Merged

[TypeDeclaration] Only apply false type on php 8.2+ configured on TypedPropertyFromAssignsRector#3422
samsonasik merged 22 commits intomainfrom
only-apply-false-type-on-php82

Conversation

@samsonasik
Copy link
Copy Markdown
Member

It currently apply false type on php <8.2, which should only apply when configured on php 8.2+ only, ref https://getrector.com/demo/2b9d1a69-3d9d-4293-8a3d-c93f47560bf0

Fixes rectorphp/rector#7809

@samsonasik
Copy link
Copy Markdown
Member Author

Fixed 🎉 /cc @koko236

@samsonasik
Copy link
Copy Markdown
Member Author

It seems cause error on pseudo false type test on union:

There was 1 failure:

1) Rector\Tests\Php80\Rector\FunctionLike\UnionTypesRector\UnionTypesRectorTest::test with data set #20
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
 
 final class FalsePseudoType
 {
-    public function go($value): false|int
+    public function go($value): bool|int
     {
         return (int) $value ?? false;

which allowed on php < 8.2

@samsonasik
Copy link
Copy Markdown
Member Author

Fixed with handle on UnionTypeMapper 05f73b9

@samsonasik
Copy link
Copy Markdown
Member Author

Finally 🎉 🎉 🎉 , All checks have passed 🎉 @TomasVotruba it is ready for review.

@samsonasik samsonasik force-pushed the only-apply-false-type-on-php82 branch from 66752f1 to 3c678c1 Compare February 28, 2023 17:41
@samsonasik
Copy link
Copy Markdown
Member Author

Rebased.

@TomasVotruba
Copy link
Copy Markdown
Member

I think there is some memory leak in paratest

@samsonasik
Copy link
Copy Markdown
Member Author

Yes, seems happened this week. I restart the build, we can back to original phpunit if it keep happening.

@samsonasik
Copy link
Copy Markdown
Member Author

Let's back to phpunit c282e62

@TomasVotruba
Copy link
Copy Markdown
Member

Feel free to merge when ready 👍

@samsonasik samsonasik merged commit 2eac878 into main Feb 28, 2023
@samsonasik samsonasik deleted the only-apply-false-type-on-php82 branch February 28, 2023 18:18
samsonasik added a commit that referenced this pull request May 8, 2023
…edPropertyFromAssignsRector (#3422)

* [TypeDeclaration] Only apply false type on php 8.2+ configured on TypedPropertyFromAssignsRector

* Fixed 🎉

* add true type fixtures

* map

* clean up comment

* Fixed with handle in UnionTypeMapper

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* fix phpstan

* Revert [ci-review] Rector Rectify

This reverts commit f765610.

* Revert [ci-review] Rector Rectify

This reverts commit e3f75ec.

* skip return type override on abstract Method Reflection

* Fix phpstan

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* skip abstract class

* Final touch: clean up with isInterface() check for detect all method are abstract

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* back to phpunit

* add back RunTestsInSeparateProcesses

* clean up fixture

---------

Co-authored-by: GitHub Action <action@github.com>
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.

Incorrect behavior of TypedPropertyFromAssignsRector

3 participants