Skip to content

Commit ac5de06

Browse files
Merge branch '3.4' into 4.4
* 3.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents 448aefe + ae9afde commit ac5de06

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

Command/DebugCommand.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct(Environment $twig, string $projectDir = null, array
5656
$this->twigDefaultPath = $twigDefaultPath;
5757

5858
if (\is_string($fileLinkFormatter) || $rootDir instanceof FileLinkFormatter) {
59-
@trigger_error(sprintf('Passing a string as "$fileLinkFormatter" 5th argument or an instance of FileLinkFormatter as "$rootDir" 6th argument of the "%s()" method is deprecated since Symfony 4.4, swap the variables position.', __METHOD__), E_USER_DEPRECATED);
59+
@trigger_error(sprintf('Passing a string as "$fileLinkFormatter" 5th argument or an instance of FileLinkFormatter as "$rootDir" 6th argument of the "%s()" method is deprecated since Symfony 4.4, swap the variables position.', __METHOD__), \E_USER_DEPRECATED);
6060

6161
$this->rootDir = $fileLinkFormatter;
6262
$this->fileLinkFormatter = $rootDir;
@@ -276,7 +276,7 @@ private function displayGeneralJson(SymfonyStyle $io, ?string $filter)
276276
$data['warnings'] = $this->buildWarningMessages($wrongBundles);
277277
}
278278

279-
$data = json_encode($data, JSON_PRETTY_PRINT);
279+
$data = json_encode($data, \JSON_PRETTY_PRINT);
280280
$io->writeln($decorated ? OutputFormatter::escape($data) : $data);
281281
}
282282

@@ -406,23 +406,23 @@ private function findWrongBundleOverrides(): array
406406
$bundleNames = [];
407407

408408
if ($this->rootDir && $this->projectDir) {
409-
$folders = glob($this->rootDir.'/Resources/*/views', GLOB_ONLYDIR);
409+
$folders = glob($this->rootDir.'/Resources/*/views', \GLOB_ONLYDIR);
410410
$relativePath = ltrim(substr($this->rootDir.\DIRECTORY_SEPARATOR.'Resources/', \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
411411
$bundleNames = array_reduce($folders, function ($carry, $absolutePath) use ($relativePath) {
412412
if (0 === strpos($absolutePath, $this->projectDir)) {
413413
$name = basename(\dirname($absolutePath));
414414
$path = ltrim($relativePath.$name, \DIRECTORY_SEPARATOR);
415415
$carry[$name] = $path;
416416

417-
@trigger_error(sprintf('Loading Twig templates from the "%s" directory is deprecated since Symfony 4.2, use "%s" instead.', $absolutePath, $this->twigDefaultPath.'/bundles/'.$name), E_USER_DEPRECATED);
417+
@trigger_error(sprintf('Loading Twig templates from the "%s" directory is deprecated since Symfony 4.2, use "%s" instead.', $absolutePath, $this->twigDefaultPath.'/bundles/'.$name), \E_USER_DEPRECATED);
418418
}
419419

420420
return $carry;
421421
}, $bundleNames);
422422
}
423423

424424
if ($this->twigDefaultPath && $this->projectDir) {
425-
$folders = glob($this->twigDefaultPath.'/bundles/*', GLOB_ONLYDIR);
425+
$folders = glob($this->twigDefaultPath.'/bundles/*', \GLOB_ONLYDIR);
426426
$relativePath = ltrim(substr($this->twigDefaultPath.'/bundles/', \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
427427
$bundleNames = array_reduce($folders, function ($carry, $absolutePath) use ($relativePath) {
428428
if (0 === strpos($absolutePath, $this->projectDir)) {
@@ -562,7 +562,7 @@ private function findAlternatives(string $name, array $collection): array
562562

563563
$threshold = 1e3;
564564
$alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
565-
ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE);
565+
ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE);
566566

567567
return array_keys($alternatives);
568568
}
@@ -578,7 +578,7 @@ private function getRelativePath(string $path): string
578578

579579
private function isAbsolutePath(string $file): bool
580580
{
581-
return strspn($file, '/\\', 0, 1) || (\strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && strspn($file, '/\\', 2, 1)) || null !== parse_url($file, PHP_URL_SCHEME);
581+
return strspn($file, '/\\', 0, 1) || (\strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && strspn($file, '/\\', 2, 1)) || null !== parse_url($file, \PHP_URL_SCHEME);
582582
}
583583

584584
/**

Command/LintCommand.php

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

8787
if (!$filenames) {
8888
// @deprecated to be removed in 5.0
89-
if (0 === ftell(STDIN)) {
90-
@trigger_error('Piping content from STDIN to the "lint:twig" command without passing the dash symbol "-" as argument is deprecated since Symfony 4.4.', E_USER_DEPRECATED);
89+
if (0 === ftell(\STDIN)) {
90+
@trigger_error('Piping content from STDIN to the "lint:twig" command without passing the dash symbol "-" as argument is deprecated since Symfony 4.4.', \E_USER_DEPRECATED);
9191

9292
return $this->display($input, $output, $io, [$this->validate(file_get_contents('php://stdin'), uniqid('sf_', true))]);
9393
}
@@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
108108

109109
if ($showDeprecations) {
110110
$prevErrorHandler = set_error_handler(static function ($level, $message, $file, $line) use (&$prevErrorHandler) {
111-
if (E_USER_DEPRECATED === $level) {
111+
if (\E_USER_DEPRECATED === $level) {
112112
$templateLine = 0;
113113
if (preg_match('/ at line (\d+)[ .]/', $message, $matches)) {
114114
$templateLine = $matches[1];
@@ -221,7 +221,7 @@ private function displayJson(OutputInterface $output, array $filesInfo)
221221
}
222222
});
223223

224-
$output->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
224+
$output->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
225225

226226
return min($errors, 1);
227227
}

Extension/CodeExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function formatArgs($args)
107107
} elseif ('resource' === $item[0]) {
108108
$formattedValue = '<em>resource</em>';
109109
} else {
110-
$formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), ENT_COMPAT | ENT_SUBSTITUTE, $this->charset));
110+
$formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset));
111111
}
112112

113113
$result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
@@ -192,7 +192,7 @@ public function formatFile($file, $line, $text = null)
192192
}
193193

194194
if (false !== $link = $this->getFileLink($file, $line)) {
195-
return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset), $text);
195+
return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset), $text);
196196
}
197197

198198
return $text;
@@ -251,7 +251,7 @@ public function formatLogMessage(string $message, array $context): string
251251
}
252252
}
253253

254-
return htmlspecialchars($message, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset);
254+
return htmlspecialchars($message, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset);
255255
}
256256

257257
/**

Extension/HttpFoundationExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct($urlHelper)
4444
throw new \TypeError(sprintf('The first argument must be an instance of "%s" or an instance of "%s".', UrlHelper::class, RequestStack::class));
4545
}
4646

47-
@trigger_error(sprintf('Passing a "%s" instance as the first argument to the "%s" constructor is deprecated since Symfony 4.3, pass a "%s" instance instead.', RequestStack::class, __CLASS__, UrlHelper::class), E_USER_DEPRECATED);
47+
@trigger_error(sprintf('Passing a "%s" instance as the first argument to the "%s" constructor is deprecated since Symfony 4.3, pass a "%s" instance instead.', RequestStack::class, __CLASS__, UrlHelper::class), \E_USER_DEPRECATED);
4848

4949
$requestContext = null;
5050
if (2 === \func_num_args()) {

TokenParser/TransChoiceTokenParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function parse(Token $token)
4141
$lineno = $token->getLine();
4242
$stream = $this->parser->getStream();
4343

44-
@trigger_error(sprintf('The "transchoice" tag is deprecated since Symfony 4.2, use the "trans" one instead with a "%%count%%" parameter in %s line %d.', $stream->getSourceContext()->getName(), $lineno), E_USER_DEPRECATED);
44+
@trigger_error(sprintf('The "transchoice" tag is deprecated since Symfony 4.2, use the "trans" one instead with a "%%count%%" parameter in %s line %d.', $stream->getSourceContext()->getName(), $lineno), \E_USER_DEPRECATED);
4545

4646
$vars = new ArrayExpression([], $lineno);
4747

Translation/TwigExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected function extractTemplate($template, MessageCatalogue $catalogue)
9191
*/
9292
protected function canBeExtracted($file)
9393
{
94-
return $this->isFile($file) && 'twig' === pathinfo($file, PATHINFO_EXTENSION);
94+
return $this->isFile($file) && 'twig' === pathinfo($file, \PATHINFO_EXTENSION);
9595
}
9696

9797
/**

TwigEngine.php

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

1212
namespace Symfony\Bridge\Twig;
1313

14-
@trigger_error('The '.TwigEngine::class.' class is deprecated since version 4.3 and will be removed in 5.0; use \Twig\Environment instead.', E_USER_DEPRECATED);
14+
@trigger_error('The '.TwigEngine::class.' class is deprecated since version 4.3 and will be removed in 5.0; use \Twig\Environment instead.', \E_USER_DEPRECATED);
1515

1616
use Symfony\Component\Templating\EngineInterface;
1717
use Symfony\Component\Templating\StreamingEngineInterface;

0 commit comments

Comments
 (0)