Skip to content

Commit

Permalink
Merge branch '4.4' into 5.1
Browse files Browse the repository at this point in the history
* 4.4:
  Enable "native_constant_invocation" CS rule
  Make AbstractPhpFileCacheWarmer public
  • Loading branch information
nicolas-grekas committed Sep 2, 2020
2 parents 4534dbf + ac5de06 commit ad3c3e8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Command/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private function displayGeneralJson(SymfonyStyle $io, ?string $filter)
$data['warnings'] = $this->buildWarningMessages($wrongBundles);
}

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

Expand Down Expand Up @@ -392,7 +392,7 @@ private function findWrongBundleOverrides(): array
$bundleNames = [];

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

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

return array_keys($alternatives);
}
Expand All @@ -548,7 +548,7 @@ private function getRelativePath(string $path): string

private function isAbsolutePath(string $file): bool
{
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);
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);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Command/LintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

if ($showDeprecations) {
$prevErrorHandler = set_error_handler(static function ($level, $message, $file, $line) use (&$prevErrorHandler) {
if (E_USER_DEPRECATED === $level) {
if (\E_USER_DEPRECATED === $level) {
$templateLine = 0;
if (preg_match('/ at line (\d+)[ .]/', $message, $matches)) {
$templateLine = $matches[1];
Expand Down Expand Up @@ -214,7 +214,7 @@ private function displayJson(OutputInterface $output, array $filesInfo)
}
});

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

return min($errors, 1);
}
Expand Down
6 changes: 3 additions & 3 deletions Extension/CodeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function formatArgs(array $args): string
} elseif ('resource' === $item[0]) {
$formattedValue = '<em>resource</em>';
} else {
$formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), ENT_COMPAT | ENT_SUBSTITUTE, $this->charset));
$formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset));
}

$result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
Expand Down Expand Up @@ -166,7 +166,7 @@ public function formatFile(string $file, int $line, string $text = null): string
}

if (false !== $link = $this->getFileLink($file, $line)) {
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);
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);
}

return $text;
Expand Down Expand Up @@ -222,7 +222,7 @@ public function formatLogMessage(string $message, array $context): string
}
}

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

protected static function fixCodeMarkup(string $line): string
Expand Down
2 changes: 1 addition & 1 deletion Translation/TwigExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected function extractTemplate(string $template, MessageCatalogue $catalogue
*/
protected function canBeExtracted(string $file)
{
return $this->isFile($file) && 'twig' === pathinfo($file, PATHINFO_EXTENSION);
return $this->isFile($file) && 'twig' === pathinfo($file, \PATHINFO_EXTENSION);
}

/**
Expand Down

0 comments on commit ad3c3e8

Please sign in to comment.