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

[DowngradePhp80] Add DowngradeNumberFormatNoFourthArgRector #1649

Merged
merged 20 commits into from
Jan 8, 2022

Conversation

samsonasik
Copy link
Member

In php 8.0, number_format allow up to 3rd argument without 4th argument, eg:

echo number_format(1000, 2, ',');

but it will cause error in php 7.x, ref https://3v4l.org/pq9e1

This PR add DowngradeNumberFormatNoFourthArgRector to add 4th argument by default value.

@samsonasik samsonasik marked this pull request as draft January 8, 2022 14:14
@samsonasik samsonasik marked this pull request as ready for review January 8, 2022 15:09
@samsonasik
Copy link
Member Author

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

@TomasVotruba TomasVotruba merged commit 1dc9483 into main Jan 8, 2022
@TomasVotruba TomasVotruba deleted the downgrade-php80-numberformat branch January 8, 2022 16:56
@TomasVotruba
Copy link
Member

Thank you 👍

@TomasVotruba
Copy link
Member

Mm, it seems after switching to "merge" strategy, all the detailed commits are now part of main branch:
https://github.com/rectorphp/rector-src/commits/main

Do you think you could squash to 1-3 important commits next time? So we have only meaninful history of commits

@@ -225,7 +225,7 @@ public function findFirstNonAnonymousClass(array $nodes): ?Node

/**
* @param Node|Node[] $nodes
* @param callable(Node $node): bool $filter
* @param callable(Node $filter): bool $filter
Copy link
Contributor

Choose a reason for hiding this comment

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

This "fix" looks like a workaround

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes

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's possibly due to cs fixer:

-     * @param Node|Node[] $nodes
-     * @param callable(Node $node): bool $filter
+     * @param Node|Node[] $filters
+     * @param callable(Node $filter): bool $filter
      */
     public function findFirst(Node | array $nodes, callable $filter): ?Node
     {
    ----------- end diff -----------


Applied checkers:

 * PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer
 * PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer
 * PhpCsFixer\Fixer\Semicolon\NoSinglelineWhitespaceBeforeSemicolonsFixer
 * Symplify\CodingStandard\Fixer\Commenting\ParamReturnAndVarTagMalformsFixer

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, it seems because of Symplify\CodingStandard\Fixer\Commenting\ParamReturnAndVarTagMalformsFixer

@samsonasik
Copy link
Member Author

@TomasVotruba will try 👍

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