{
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');
function twig_default_filter($value, $default = '')
{
- return is_null($value) ? $default : $value;
+ return null === $value ? $default : $value;
}
function twig_get_array_keys_filter($array)
function twig_upper_filter(Twig_Environment $env, $string)
{
- if (!is_null($charset = $env->getCharset())) {
+ if (null !== ($charset = $env->getCharset())) {
return mb_strtoupper($string, $charset);
}
function twig_lower_filter(Twig_Environment $env, $string)
{
- if (!is_null($charset = $env->getCharset())) {
+ if (null !== ($charset = $env->getCharset())) {
return mb_strtolower($string, $charset);
}
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);
}
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);
}
->write('$context[\'_parent\'] = (array) $context;'."\n")
;
- if (!is_null($this->getNode('else'))) {
+ if (null !== $this->getNode('else')) {
$compiler->write("\$context['_iterated'] = false;\n");
}
->indent()
;
- if (!is_null($this->getNode('else'))) {
+ if (null !== $this->getNode('else')) {
$compiler->write("\$context['_iterated'] = true;\n");
}
->write("}\n")
;
- if (!is_null($this->getNode('else'))) {
+ if (null !== $this->getNode('else')) {
$compiler
->write("if (!\$context['_iterated']) {\n")
->indent()
try {
$body = $this->subparse(null);
} catch (Twig_Error_Syntax $e) {
- if (is_null($e->getFilename())) {
+ if (null === $e->getFilename()) {
$e->setFilename($this->stream->getFilename());
}
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();
}
$this->stream->next();
$node = $subparser->parse($token);
- if (!is_null($node)) {
+ if (null !== $node) {
$rv[] = $node;
}
break;
*/
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
);