Skip to content

Commit a993849

Browse files
Enable "native_constant_invocation" CS rule
1 parent 5ceca59 commit a993849

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

Compiler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ public function string($value)
111111
public function repr($value)
112112
{
113113
if (\is_int($value) || \is_float($value)) {
114-
if (false !== $locale = setlocale(LC_NUMERIC, 0)) {
115-
setlocale(LC_NUMERIC, 'C');
114+
if (false !== $locale = setlocale(\LC_NUMERIC, 0)) {
115+
setlocale(\LC_NUMERIC, 'C');
116116
}
117117

118118
$this->raw($value);
119119

120120
if (false !== $locale) {
121-
setlocale(LC_NUMERIC, $locale);
121+
setlocale(\LC_NUMERIC, $locale);
122122
}
123123
} elseif (null === $value) {
124124
$this->raw('null');

ExpressionLanguage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct($cache = null, array $providers = [])
3838
{
3939
if (null !== $cache) {
4040
if ($cache instanceof ParserCacheInterface) {
41-
@trigger_error(sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of 3.2 and will be removed in 4.0. Pass an instance of %s instead.', ParserCacheInterface::class, self::class, CacheItemPoolInterface::class), E_USER_DEPRECATED);
41+
@trigger_error(sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of 3.2 and will be removed in 4.0. Pass an instance of %s instead.', ParserCacheInterface::class, self::class, CacheItemPoolInterface::class), \E_USER_DEPRECATED);
4242
$cache = new ParserCacheAdapter($cache);
4343
} elseif (!$cache instanceof CacheItemPoolInterface) {
4444
throw new \InvalidArgumentException(sprintf('Cache argument has to implement "%s".', CacheItemPoolInterface::class));

Lexer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function tokenize($expression)
4545
if (preg_match('/[0-9]+(?:\.[0-9]+)?/A', $expression, $match, 0, $cursor)) {
4646
// numbers
4747
$number = (float) $match[0]; // floats
48-
if (preg_match('/^[0-9]+$/', $match[0]) && $number <= PHP_INT_MAX) {
48+
if (preg_match('/^[0-9]+$/', $match[0]) && $number <= \PHP_INT_MAX) {
4949
$number = (int) $match[0]; // integers lower than the maximum
5050
}
5151
$tokens[] = new Token(Token::NUMBER_TYPE, $number, $cursor + 1);

ParserCache/ArrayParserCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\ExpressionLanguage\ParserCache;
1313

14-
@trigger_error('The '.__NAMESPACE__.'\ArrayParserCache class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead.', E_USER_DEPRECATED);
14+
@trigger_error('The '.__NAMESPACE__.'\ArrayParserCache class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead.', \E_USER_DEPRECATED);
1515

1616
use Symfony\Component\ExpressionLanguage\ParsedExpression;
1717

ParserCache/ParserCacheInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\ExpressionLanguage\ParserCache;
1313

14-
@trigger_error('The '.__NAMESPACE__.'\ParserCacheInterface interface is deprecated since Symfony 3.2 and will be removed in 4.0. Use Psr\Cache\CacheItemPoolInterface instead.', E_USER_DEPRECATED);
14+
@trigger_error('The '.__NAMESPACE__.'\ParserCacheInterface interface is deprecated since Symfony 3.2 and will be removed in 4.0. Use Psr\Cache\CacheItemPoolInterface instead.', \E_USER_DEPRECATED);
1515

1616
use Symfony\Component\ExpressionLanguage\ParsedExpression;
1717

SyntaxError.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct($message, $cursor = 0, $expression = '', $subject =
2222
$message .= '.';
2323

2424
if (null !== $subject && null !== $proposals) {
25-
$minScore = INF;
25+
$minScore = \INF;
2626
foreach ($proposals as $proposal) {
2727
$distance = levenshtein($subject, $proposal);
2828
if ($distance < $minScore) {

Tests/ExpressionLanguageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function testWrongCacheImplementation()
104104
public function testConstantFunction()
105105
{
106106
$expressionLanguage = new ExpressionLanguage();
107-
$this->assertEquals(PHP_VERSION, $expressionLanguage->evaluate('constant("PHP_VERSION")'));
107+
$this->assertEquals(\PHP_VERSION, $expressionLanguage->evaluate('constant("PHP_VERSION")'));
108108

109109
$expressionLanguage = new ExpressionLanguage();
110110
$this->assertEquals('\constant("PHP_VERSION")', $expressionLanguage->compile('constant("PHP_VERSION")'));

0 commit comments

Comments
 (0)