replace all is_null($value) with null === $value

This commit is contained in:
stloyd
2010-11-24 21:29:49 +01:00
committed by Fabien Potencier
parent 485406036f
commit 515741a8e0
5 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ class Twig_Compiler implements Twig_CompilerInterface
{
if (is_int($value) || is_float($value)) {
$this->raw($value);
} else if (is_null($value)) {
} else if (null === $value) {
$this->raw('null');
} else if (is_bool($value)) {
$this->raw($value ? 'true' : 'false');
+5 -5
View File
@@ -139,7 +139,7 @@ function twig_join_filter($value, $glue = '')
function twig_default_filter($value, $default = '')
{
return is_null($value) ? $default : $value;
return null === $value ? $default : $value;
}
function twig_get_array_keys_filter($array)
@@ -309,7 +309,7 @@ if (function_exists('mb_get_info')) {
function twig_upper_filter(Twig_Environment $env, $string)
{
if (!is_null($charset = $env->getCharset())) {
if (null !== ($charset = $env->getCharset())) {
return mb_strtoupper($string, $charset);
}
@@ -318,7 +318,7 @@ if (function_exists('mb_get_info')) {
function twig_lower_filter(Twig_Environment $env, $string)
{
if (!is_null($charset = $env->getCharset())) {
if (null !== ($charset = $env->getCharset())) {
return mb_strtolower($string, $charset);
}
@@ -327,7 +327,7 @@ if (function_exists('mb_get_info')) {
function twig_title_string_filter(Twig_Environment $env, $string)
{
if (!is_null($charset = $env->getCharset())) {
if (null !== ($charset = $env->getCharset())) {
return mb_convert_case($string, MB_CASE_TITLE, $charset);
}
@@ -336,7 +336,7 @@ if (function_exists('mb_get_info')) {
function twig_capitalize_string_filter(Twig_Environment $env, $string)
{
if (!is_null($charset = $env->getCharset())) {
if (null !== ($charset = $env->getCharset())) {
return mb_strtoupper(mb_substr($string, 0, 1, $charset)).
mb_strtolower(mb_substr($string, 1, mb_strlen($string), $charset), $charset);
}
+3 -3
View File
@@ -36,7 +36,7 @@ class Twig_Node_For extends Twig_Node
->write('$context[\'_parent\'] = (array) $context;'."\n")
;
if (!is_null($this->getNode('else'))) {
if (null !== $this->getNode('else')) {
$compiler->write("\$context['_iterated'] = false;\n");
}
@@ -77,7 +77,7 @@ class Twig_Node_For extends Twig_Node
->indent()
;
if (!is_null($this->getNode('else'))) {
if (null !== $this->getNode('else')) {
$compiler->write("\$context['_iterated'] = true;\n");
}
@@ -103,7 +103,7 @@ class Twig_Node_For extends Twig_Node
->write("}\n")
;
if (!is_null($this->getNode('else'))) {
if (null !== $this->getNode('else')) {
$compiler
->write("if (!\$context['_iterated']) {\n")
->indent()
+3 -3
View File
@@ -62,7 +62,7 @@ class Twig_Parser implements Twig_ParserInterface
try {
$body = $this->subparse(null);
} catch (Twig_Error_Syntax $e) {
if (is_null($e->getFilename())) {
if (null === $e->getFilename()) {
$e->setFilename($this->stream->getFilename());
}
@@ -106,7 +106,7 @@ class Twig_Parser implements Twig_ParserInterface
throw new Twig_Error_Syntax('A block must start with a tag name', $token->getLine());
}
if (!is_null($test) && call_user_func($test, $token)) {
if (null !== $test && call_user_func($test, $token)) {
if ($dropNeedle) {
$this->stream->next();
}
@@ -122,7 +122,7 @@ class Twig_Parser implements Twig_ParserInterface
$this->stream->next();
$node = $subparser->parse($token);
if (!is_null($node)) {
if (null !== $node) {
$rv[] = $node;
}
break;
+2 -2
View File
@@ -47,13 +47,13 @@ class Twig_Token
*/
public function test($type, $values = null)
{
if (is_null($values) && !is_int($type)) {
if (null === $values && !is_int($type)) {
$values = $type;
$type = self::NAME_TYPE;
}
return ($this->type === $type) && (
is_null($values) ||
null === $values ||
(is_array($values) && in_array($this->value, $values)) ||
$this->value == $values
);