Add missing true for in_array

This commit is contained in:
Fabien Potencier
2025-02-21 19:10:34 +01:00
parent bd652f3e66
commit b0922a1c1a
2 changed files with 4 additions and 4 deletions
@@ -22,13 +22,13 @@ final class LocalVariable extends AbstractExpression
public function __construct(string|int|null $name, int $lineno)
{
// All names supported by ExpressionParser::parsePrimaryExpression() should be excluded
if ($name && \in_array(strtolower($name), ['true', 'false', 'none', 'null'])) {
if ($name && \in_array(strtolower($name), ['true', 'false', 'none', 'null'], true)) {
throw new SyntaxError(\sprintf('You cannot assign a value to "%s".', $name), $lineno);
}
if (null !== $name && (\is_int($name) || ctype_digit($name))) {
$name = (int) $name;
} elseif (\in_array($name, self::RESERVED_NAMES)) {
} elseif (\in_array($name, self::RESERVED_NAMES, true)) {
$name = "\u{035C}".$name;
}
@@ -22,13 +22,13 @@ final class TemplateVariable extends AbstractExpression
public function __construct(string|int|null $name, int $lineno)
{
// All names supported by ExpressionParser::parsePrimaryExpression() should be excluded
if ($name && \in_array(strtolower($name), ['true', 'false', 'none', 'null'])) {
if ($name && \in_array(strtolower($name), ['true', 'false', 'none', 'null'], true)) {
throw new SyntaxError(\sprintf('You cannot assign a value to "%s".', $name), $lineno);
}
if (null !== $name && (\is_int($name) || ctype_digit($name))) {
$name = (int) $name;
} elseif (\in_array($name, self::RESERVED_NAMES)) {
} elseif (\in_array($name, self::RESERVED_NAMES, true)) {
$name = "\u{035C}".$name;
}