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

NullableTypeDeclarationForDefaultNullValueFixer - fix for nullable with attribute #5665

Merged
merged 1 commit into from Apr 30, 2021
Merged

NullableTypeDeclarationForDefaultNullValueFixer - fix for nullable with attribute #5665

merged 1 commit into from Apr 30, 2021

Conversation

kubawerlos
Copy link
Contributor

@kubawerlos kubawerlos commented Apr 28, 2021

Fixes #5533

@coveralls
Copy link

coveralls commented Apr 28, 2021

Coverage Status

Coverage decreased (-0.009%) to 91.892% when pulling 068aedb on kubawerlos:fix_NullableTypeDeclarationForDefaultNullValueFixer into 0869890 on FriendsOfPHP:2.18.

@kubawerlos
Copy link
Contributor Author

@keradus @julienfalque @SpacePossum @localheinz should we extend Tokens::getNextMeaningfulToken to skip PHP 8 attributes as it this case ArgumentsAnalyzer includes it into the type and creates <?php function foo(?#[AnAttribute] string $param = null) {} which is invalid syntax?

@keradus
Copy link
Member

keradus commented Apr 28, 2021

attributes are meaningful.
we also fix their content, eg

-#[MyAttribute(array("key" => "value"))]
+#[MyAttribute(['key' => 'value'])]

@kubawerlos kubawerlos marked this pull request as ready for review April 29, 2021 17:27
@kubawerlos kubawerlos added this to the 2.18.7 milestone Apr 29, 2021
@keradus
Copy link
Member

keradus commented Apr 30, 2021

Thank you @kubawerlos.

@keradus keradus merged commit f2e555a into PHP-CS-Fixer:2.18 Apr 30, 2021
@OskarStark
Copy link
Contributor

Thank you very much 🥰

@kubawerlos kubawerlos deleted the fix_NullableTypeDeclarationForDefaultNullValueFixer branch April 30, 2021 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem with custom attribute
4 participants