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] Handle default value with contant type on TypedPropertyFromAssignsRector #6563

Merged
merged 5 commits into from
Dec 12, 2024

Conversation

samsonasik
Copy link
Member

continue of PR:

this PR handle default value with constant type, false type can't match with true, so it needs to be bool as final type.

@samsonasik
Copy link
Member Author

Fixed 🎉

@samsonasik
Copy link
Member Author

It seems cause error on TypedPropertyFromStrictConstructorRector, I will check

1) Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector\TypedPropertyFromStrictConstructorRectorTest::test with data set #1 ('/Users/samsonasik/www/rector-...hp.inc')
Failed on fixture file "default_array_merge.php.inc"
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
 
 final class DefaultArrayMerge
 {
-    private array $options = [
+    private $options = [
         'key' => 'value'
     ];

@samsonasik
Copy link
Member Author

@yguedidi I updated use bool over false for now, to handle regression when default value is true.

That's possibly for future improvement :)

@samsonasik samsonasik merged commit 184eb2e into main Dec 12, 2024
41 checks passed
@samsonasik samsonasik deleted the handle-default-value-constant branch December 12, 2024 01:12
@yguedidi
Copy link
Contributor

@samsonasik fine for me!

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.

2 participants