Skip to content

Commit 4b9c6dc

Browse files
Merge branch '3.4' into 4.4
* 3.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents e2a6952 + c2162b5 commit 4b9c6dc

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

Command/LintCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
9393

9494
// @deprecated to be removed in 5.0
9595
if (!$filenames) {
96-
if (0 === ftell(STDIN)) {
97-
@trigger_error('Piping content from STDIN to the "lint:yaml" command without passing the dash symbol "-" as argument is deprecated since Symfony 4.4.', E_USER_DEPRECATED);
96+
if (0 === ftell(\STDIN)) {
97+
@trigger_error('Piping content from STDIN to the "lint:yaml" command without passing the dash symbol "-" as argument is deprecated since Symfony 4.4.', \E_USER_DEPRECATED);
9898

9999
return $this->display($io, [$this->validate(file_get_contents('php://stdin'), $flags)]);
100100
}
@@ -119,7 +119,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
119119
private function validate(string $content, int $flags, string $file = null)
120120
{
121121
$prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler) {
122-
if (E_USER_DEPRECATED === $level) {
122+
if (\E_USER_DEPRECATED === $level) {
123123
throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1);
124124
}
125125

@@ -193,7 +193,7 @@ private function displayJson(SymfonyStyle $io, array $filesInfo): int
193193
}
194194
});
195195

196-
$io->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
196+
$io->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
197197

198198
return min($errors, 1);
199199
}

Exception/ParseException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private function updateRepr()
121121
}
122122

123123
if (null !== $this->parsedFile) {
124-
$this->message .= sprintf(' in %s', json_encode($this->parsedFile, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
124+
$this->message .= sprintf(' in %s', json_encode($this->parsedFile, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
125125
}
126126

127127
if ($this->parsedLine >= 0) {

Inline.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ public static function dump($value, int $flags = 0): string
162162
case ctype_digit($value):
163163
return \is_string($value) ? "'$value'" : (int) $value;
164164
case is_numeric($value) && false === strpos($value, "\f") && false === strpos($value, "\n") && false === strpos($value, "\r") && false === strpos($value, "\t") && false === strpos($value, "\v"):
165-
$locale = setlocale(LC_NUMERIC, 0);
165+
$locale = setlocale(\LC_NUMERIC, 0);
166166
if (false !== $locale) {
167-
setlocale(LC_NUMERIC, 'C');
167+
setlocale(\LC_NUMERIC, 'C');
168168
}
169169
if (\is_float($value)) {
170170
$repr = (string) $value;
@@ -178,7 +178,7 @@ public static function dump($value, int $flags = 0): string
178178
$repr = \is_string($value) ? "'$value'" : (string) $value;
179179
}
180180
if (false !== $locale) {
181-
setlocale(LC_NUMERIC, $locale);
181+
setlocale(\LC_NUMERIC, $locale);
182182
}
183183

184184
return $repr;
@@ -289,7 +289,7 @@ public static function parseScalar(string $scalar, int $flags = 0, array $delimi
289289
$i += \strlen($output);
290290

291291
// remove comments
292-
if (Parser::preg_match('/[ \t]+#/', $output, $match, PREG_OFFSET_CAPTURE)) {
292+
if (Parser::preg_match('/[ \t]+#/', $output, $match, \PREG_OFFSET_CAPTURE)) {
293293
$output = substr($output, 0, $match[0][1]);
294294
}
295295
} elseif (Parser::preg_match('/^(.*?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) {

Parser.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ private function doParse(string $value, int $flags)
443443
}
444444

445445
if (false !== strpos($line, ': ')) {
446-
@trigger_error('Support for mapping keys in multi-line blocks is deprecated since Symfony 4.3 and will throw a ParseException in 5.0.', E_USER_DEPRECATED);
446+
@trigger_error('Support for mapping keys in multi-line blocks is deprecated since Symfony 4.3 and will throw a ParseException in 5.0.', \E_USER_DEPRECATED);
447447
}
448448

449449
if ('' === trim($line)) {
@@ -1072,19 +1072,19 @@ public static function preg_match(string $pattern, string $subject, array &$matc
10721072
{
10731073
if (false === $ret = preg_match($pattern, $subject, $matches, $flags, $offset)) {
10741074
switch (preg_last_error()) {
1075-
case PREG_INTERNAL_ERROR:
1075+
case \PREG_INTERNAL_ERROR:
10761076
$error = 'Internal PCRE error.';
10771077
break;
1078-
case PREG_BACKTRACK_LIMIT_ERROR:
1078+
case \PREG_BACKTRACK_LIMIT_ERROR:
10791079
$error = 'pcre.backtrack_limit reached.';
10801080
break;
1081-
case PREG_RECURSION_LIMIT_ERROR:
1081+
case \PREG_RECURSION_LIMIT_ERROR:
10821082
$error = 'pcre.recursion_limit reached.';
10831083
break;
1084-
case PREG_BAD_UTF8_ERROR:
1084+
case \PREG_BAD_UTF8_ERROR:
10851085
$error = 'Malformed UTF-8 data.';
10861086
break;
1087-
case PREG_BAD_UTF8_OFFSET_ERROR:
1087+
case \PREG_BAD_UTF8_OFFSET_ERROR:
10881088
$error = 'Offset doesn\'t correspond to the begin of a valid UTF-8 code point.';
10891089
break;
10901090
default:

Tests/InlineTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ public function getTestsForParsePhpConstants()
5656
{
5757
return [
5858
['!php/const Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT],
59-
['!php/const PHP_INT_MAX', PHP_INT_MAX],
60-
['[!php/const PHP_INT_MAX]', [PHP_INT_MAX]],
61-
['{ foo: !php/const PHP_INT_MAX }', ['foo' => PHP_INT_MAX]],
62-
['{ !php/const PHP_INT_MAX: foo }', [PHP_INT_MAX => 'foo']],
59+
['!php/const PHP_INT_MAX', \PHP_INT_MAX],
60+
['[!php/const PHP_INT_MAX]', [\PHP_INT_MAX]],
61+
['{ foo: !php/const PHP_INT_MAX }', ['foo' => \PHP_INT_MAX]],
62+
['{ !php/const PHP_INT_MAX: foo }', [\PHP_INT_MAX => 'foo']],
6363
['!php/const NULL', null],
6464
];
6565
}
@@ -90,21 +90,21 @@ public function testDump($yaml, $value, $parseFlags = 0)
9090

9191
public function testDumpNumericValueWithLocale()
9292
{
93-
$locale = setlocale(LC_NUMERIC, 0);
93+
$locale = setlocale(\LC_NUMERIC, 0);
9494
if (false === $locale) {
9595
$this->markTestSkipped('Your platform does not support locales.');
9696
}
9797

9898
try {
9999
$requiredLocales = ['fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'];
100-
if (false === setlocale(LC_NUMERIC, $requiredLocales)) {
100+
if (false === setlocale(\LC_NUMERIC, $requiredLocales)) {
101101
$this->markTestSkipped('Could not set any of required locales: '.implode(', ', $requiredLocales));
102102
}
103103

104104
$this->assertEquals('1.2', Inline::dump(1.2));
105-
$this->assertStringContainsStringIgnoringCase('fr', setlocale(LC_NUMERIC, 0));
105+
$this->assertStringContainsStringIgnoringCase('fr', setlocale(\LC_NUMERIC, 0));
106106
} finally {
107-
setlocale(LC_NUMERIC, $locale);
107+
setlocale(\LC_NUMERIC, $locale);
108108
}
109109
}
110110

0 commit comments

Comments
 (0)