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

The deprecated null value for the method round has been changed to zero. #3626

Merged
merged 1 commit into from
Jan 11, 2022
Merged

The deprecated null value for the method round has been changed to zero. #3626

merged 1 commit into from
Jan 11, 2022

Conversation

Parovozzzik
Copy link

No description provided.

Copy link
Contributor

@fabpot fabpot left a comment

Choose a reason for hiding this comment

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

Maybe we can move 554 as the first line of code instead?
Can you also add some tests (in Fixtures)?

@Parovozzzik
Copy link
Author

Parovozzzik commented Jan 11, 2022

@fabpot, I don't see what you mean about 554... we can do it like this:

function twig_round($value, $precision = 0, $method = 'common')
{
    if (!isset($value)) {
        return 0;
    }
...
}

@fabpot
Copy link
Contributor

fabpot commented Jan 11, 2022

Line is $value = (float) $value;. If you move this line to the beginning of the method, then, there is no other change to do as the value will always be a float.

@@ -1,6 +1,7 @@
--TEST--
"round" filter
--TEMPLATE--
{{ null|round }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also add two other tests for the ceil and floor methods?

Copy link
Member

@stof stof Jan 11, 2022

Choose a reason for hiding this comment

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

floor is already tested (that's the last case), but ceil is indeed missing.

Copy link
Author

Choose a reason for hiding this comment

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

Done

@fabpot fabpot changed the base branch from 3.x to 2.x January 11, 2022 15:12
@fabpot
Copy link
Contributor

fabpot commented Jan 11, 2022

Thank you @Parovozzzik.

@fabpot fabpot merged commit e8068a9 into twigphp:2.x Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants