Skip to content

Commit 07bc35f

Browse files
Merge branch '3.4' into 4.0
* 3.4: Fix Clidumper tests Enable the fixer enforcing fully-qualified calls for compiler-optimized functions Apply fixers Disable the native_constant_invocation fixer until it can be scoped Update the list of excluded files for the CS fixer
2 parents c13866b + 48c93e8 commit 07bc35f

16 files changed

+41
-41
lines changed

AppVariable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function getUser()
8383
}
8484

8585
$user = $token->getUser();
86-
if (is_object($user)) {
86+
if (\is_object($user)) {
8787
return $user;
8888
}
8989
}
@@ -169,7 +169,7 @@ public function getFlashes($types = null)
169169
return $session->getFlashBag()->all();
170170
}
171171

172-
if (is_string($types)) {
172+
if (\is_string($types)) {
173173
return $session->getFlashBag()->get($types);
174174
}
175175

Command/DebugCommand.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
111111
$firstNamespace = true;
112112
$prevHasSeparator = false;
113113
foreach ($this->getLoaderPaths() as $namespace => $paths) {
114-
if (!$firstNamespace && !$prevHasSeparator && count($paths) > 1) {
114+
if (!$firstNamespace && !$prevHasSeparator && \count($paths) > 1) {
115115
$rows[] = array('', '');
116116
}
117117
$firstNamespace = false;
118118
foreach ($paths as $path) {
119119
$rows[] = array($namespace, $path.DIRECTORY_SEPARATOR);
120120
$namespace = '';
121121
}
122-
if (count($paths) > 1) {
122+
if (\count($paths) > 1) {
123123
$rows[] = array('', '');
124124
$prevHasSeparator = true;
125125
} else {
@@ -145,7 +145,7 @@ private function getLoaderPaths()
145145
foreach ($loader->getNamespaces() as $namespace) {
146146
$paths = array_map(function ($path) {
147147
if (null !== $this->projectDir && 0 === strpos($path, $this->projectDir)) {
148-
$path = ltrim(substr($path, strlen($this->projectDir)), DIRECTORY_SEPARATOR);
148+
$path = ltrim(substr($path, \strlen($this->projectDir)), DIRECTORY_SEPARATOR);
149149
}
150150

151151
return $path;
@@ -176,16 +176,16 @@ private function getMetadata($type, $entity)
176176
if (null === $cb) {
177177
return;
178178
}
179-
if (is_array($cb)) {
179+
if (\is_array($cb)) {
180180
if (!method_exists($cb[0], $cb[1])) {
181181
return;
182182
}
183183
$refl = new \ReflectionMethod($cb[0], $cb[1]);
184-
} elseif (is_object($cb) && method_exists($cb, '__invoke')) {
184+
} elseif (\is_object($cb) && method_exists($cb, '__invoke')) {
185185
$refl = new \ReflectionMethod($cb, '__invoke');
186-
} elseif (function_exists($cb)) {
186+
} elseif (\function_exists($cb)) {
187187
$refl = new \ReflectionFunction($cb);
188-
} elseif (is_string($cb) && preg_match('{^(.+)::(.+)$}', $cb, $m) && method_exists($m[1], $m[2])) {
188+
} elseif (\is_string($cb) && preg_match('{^(.+)::(.+)$}', $cb, $m) && method_exists($m[1], $m[2])) {
189189
$refl = new \ReflectionMethod($m[1], $m[2]);
190190
} else {
191191
throw new \UnexpectedValueException('Unsupported callback type');
@@ -235,8 +235,8 @@ private function getPrettyMetadata($type, $entity)
235235
}
236236

237237
if ('globals' === $type) {
238-
if (is_object($meta)) {
239-
return ' = object('.get_class($meta).')';
238+
if (\is_object($meta)) {
239+
return ' = object('.\get_class($meta).')';
240240
}
241241

242242
return ' = '.substr(@json_encode($meta), 0, 50);

Command/LintCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7777
$io = new SymfonyStyle($input, $output);
7878
$filenames = $input->getArgument('filename');
7979

80-
if (0 === count($filenames)) {
80+
if (0 === \count($filenames)) {
8181
if (0 !== ftell(STDIN)) {
8282
throw new RuntimeException('Please provide a filename or pipe template content to STDIN.');
8383
}
@@ -162,9 +162,9 @@ private function displayTxt(OutputInterface $output, SymfonyStyle $io, $filesInf
162162
}
163163

164164
if (0 === $errors) {
165-
$io->success(sprintf('All %d Twig files contain valid syntax.', count($filesInfo)));
165+
$io->success(sprintf('All %d Twig files contain valid syntax.', \count($filesInfo)));
166166
} else {
167-
$io->warning(sprintf('%d Twig files have valid syntax and %d contain errors.', count($filesInfo) - $errors, $errors));
167+
$io->warning(sprintf('%d Twig files have valid syntax and %d contain errors.', \count($filesInfo) - $errors, $errors));
168168
}
169169

170170
return min($errors, 1);
@@ -217,7 +217,7 @@ private function getContext($template, $line, $context = 3)
217217
$lines = explode("\n", $template);
218218

219219
$position = max(0, $line - $context);
220-
$max = min(count($lines), $line - 1 + $context);
220+
$max = min(\count($lines), $line - 1 + $context);
221221

222222
$result = array();
223223
while ($position < $max) {

Extension/CodeExtension.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CodeExtension extends AbstractExtension
3434
public function __construct($fileLinkFormat, string $rootDir, string $charset)
3535
{
3636
$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
37-
$this->rootDir = str_replace('/', DIRECTORY_SEPARATOR, dirname($rootDir)).DIRECTORY_SEPARATOR;
37+
$this->rootDir = str_replace('/', DIRECTORY_SEPARATOR, \dirname($rootDir)).DIRECTORY_SEPARATOR;
3838
$this->charset = $charset;
3939
}
4040

@@ -94,7 +94,7 @@ public function formatArgs($args)
9494
$short = array_pop($parts);
9595
$formattedValue = sprintf('<em>object</em>(<abbr title="%s">%s</abbr>)', $item[1], $short);
9696
} elseif ('array' === $item[0]) {
97-
$formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
97+
$formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
9898
} elseif ('null' === $item[0]) {
9999
$formattedValue = '<em>null</em>';
100100
} elseif ('boolean' === $item[0]) {
@@ -105,7 +105,7 @@ public function formatArgs($args)
105105
$formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), ENT_COMPAT | ENT_SUBSTITUTE, $this->charset));
106106
}
107107

108-
$result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
108+
$result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
109109
}
110110

111111
return implode(', ', $result);
@@ -148,10 +148,10 @@ public function fileExcerpt($file, $line, $srcContext = 3)
148148

149149
$lines = array();
150150
if (0 > $srcContext) {
151-
$srcContext = count($content);
151+
$srcContext = \count($content);
152152
}
153153

154-
for ($i = max($line - $srcContext, 1), $max = min($line + $srcContext, count($content)); $i <= $max; ++$i) {
154+
for ($i = max($line - $srcContext, 1), $max = min($line + $srcContext, \count($content)); $i <= $max; ++$i) {
155155
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><a class="anchor" name="line'.$i.'"></a><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>';
156156
}
157157

@@ -175,7 +175,7 @@ public function formatFile($file, $line, $text = null)
175175
if (null === $text) {
176176
$text = str_replace('/', DIRECTORY_SEPARATOR, $file);
177177
if (0 === strpos($text, $this->rootDir)) {
178-
$text = substr($text, strlen($this->rootDir));
178+
$text = substr($text, \strlen($this->rootDir));
179179
$text = explode(DIRECTORY_SEPARATOR, $text, 2);
180180
$text = sprintf('<abbr title="%s%2$s">%s</abbr>%s', $this->rootDir, $text[0], isset($text[1]) ? DIRECTORY_SEPARATOR.$text[1] : '');
181181
}
@@ -203,7 +203,7 @@ public function formatFile($file, $line, $text = null)
203203
public function getFileLink($file, $line)
204204
{
205205
if ($fmt = $this->fileLinkFormat) {
206-
return is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line);
206+
return \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line);
207207
}
208208

209209
return false;

Extension/DumpExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function dump(Environment $env, $context)
5858
return;
5959
}
6060

61-
if (2 === func_num_args()) {
61+
if (2 === \func_num_args()) {
6262
$vars = array();
6363
foreach ($context as $key => $value) {
6464
if (!$value instanceof Template) {
@@ -68,7 +68,7 @@ public function dump(Environment $env, $context)
6868

6969
$vars = array($vars);
7070
} else {
71-
$vars = func_get_args();
71+
$vars = \func_get_args();
7272
unset($vars[0], $vars[1]);
7373
}
7474

Extension/FormExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ public function getName()
100100
*/
101101
function twig_is_selected_choice(ChoiceView $choice, $selectedValue)
102102
{
103-
if (is_array($selectedValue)) {
104-
return in_array($choice->value, $selectedValue, true);
103+
if (\is_array($selectedValue)) {
104+
return \in_array($choice->value, $selectedValue, true);
105105
}
106106

107107
return $choice->value === $selectedValue;

Extension/HttpFoundationExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function generateAbsoluteUrl($path)
9797

9898
if (!$path || '/' !== $path[0]) {
9999
$prefix = $request->getPathInfo();
100-
$last = strlen($prefix) - 1;
100+
$last = \strlen($prefix) - 1;
101101
if ($last !== $pos = strrpos($prefix, '/')) {
102102
$prefix = substr($prefix, 0, $pos).'/';
103103
}

Extension/RoutingExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function isUrlGenerationSafe(Node $argsNode)
100100
$argsNode->hasNode(1) ? $argsNode->getNode(1) : null
101101
);
102102

103-
if (null === $paramsNode || $paramsNode instanceof ArrayExpression && count($paramsNode) <= 2 &&
103+
if (null === $paramsNode || $paramsNode instanceof ArrayExpression && \count($paramsNode) <= 2 &&
104104
(!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof ConstantExpression)
105105
) {
106106
return array('html');

Extension/YamlExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function encode($input, $inline = 0, $dumpObjects = 0)
4242
$dumper = new YamlDumper();
4343
}
4444

45-
if (defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) {
45+
if (\defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) {
4646
return $dumper->dump($input, $inline, 0, $dumpObjects);
4747
}
4848

@@ -51,12 +51,12 @@ public function encode($input, $inline = 0, $dumpObjects = 0)
5151

5252
public function dump($value, $inline = 0, $dumpObjects = false)
5353
{
54-
if (is_resource($value)) {
54+
if (\is_resource($value)) {
5555
return '%Resource%';
5656
}
5757

58-
if (is_array($value) || is_object($value)) {
59-
return '%'.gettype($value).'% '.$this->encode($value, $inline, $dumpObjects);
58+
if (\is_array($value) || \is_object($value)) {
59+
return '%'.\gettype($value).'% '.$this->encode($value, $inline, $dumpObjects);
6060
}
6161

6262
return $this->encode($value, $inline, $dumpObjects);

Form/TwigRendererEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function loadResourceForBlockName($cacheKey, FormView $view, $blockNam
9898

9999
// Check each theme whether it contains the searched block
100100
if (isset($this->themes[$cacheKey])) {
101-
for ($i = count($this->themes[$cacheKey]) - 1; $i >= 0; --$i) {
101+
for ($i = \count($this->themes[$cacheKey]) - 1; $i >= 0; --$i) {
102102
$this->loadResourcesFromTheme($cacheKey, $this->themes[$cacheKey][$i]);
103103
// CONTINUE LOADING (see doc comment)
104104
}
@@ -107,7 +107,7 @@ protected function loadResourceForBlockName($cacheKey, FormView $view, $blockNam
107107
// Check the default themes once we reach the root view without success
108108
if (!$view->parent) {
109109
if (!isset($this->useDefaultThemes[$cacheKey]) || $this->useDefaultThemes[$cacheKey]) {
110-
for ($i = count($this->defaultThemes) - 1; $i >= 0; --$i) {
110+
for ($i = \count($this->defaultThemes) - 1; $i >= 0; --$i) {
111111
$this->loadResourcesFromTheme($cacheKey, $this->defaultThemes[$i]);
112112
// CONTINUE LOADING (see doc comment)
113113
}

0 commit comments

Comments
 (0)