minor #3275 Identity Equals - Best practices (hectorprats)

This PR was submitted for the 3.x branch but it was merged into the 1.x branch instead.

Discussion
----------

Identity Equals - Best practices

all the equals are with identity equals, except these.

It's better normalize all the comparatives operations.

Commits
-------

60d5b4bc Identity Equals - Best practices
This commit is contained in:
Fabien Potencier
2020-02-26 13:13:58 +01:00
+3 -3
View File
@@ -539,11 +539,11 @@ function twig_replace_filter($str, $from, $to = null)
*/
function twig_round($value, $precision = 0, $method = 'common')
{
if ('common' == $method) {
if ('common' === $method) {
return round($value, $precision);
}
if ('ceil' != $method && 'floor' != $method) {
if ('ceil' !== $method && 'floor' !== $method) {
throw new RuntimeError('The round filter only supports the "common", "ceil", and "floor" methods.');
}
@@ -1504,7 +1504,7 @@ function twig_to_array($seq, $preserveKeys = true)
function twig_test_empty($value)
{
if ($value instanceof \Countable) {
return 0 == \count($value);
return 0 === \count($value);
}
if ($value instanceof \Traversable) {