Skip to content

Commit f503315

Browse files
Merge branch '2.8' into 3.4
* 2.8: 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 46f0a29 + 15579a6 commit f503315

File tree

91 files changed

+260
-260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+260
-260
lines changed

AbstractExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function hasTypeExtensions($name)
9898
$this->initTypeExtensions();
9999
}
100100

101-
return isset($this->typeExtensions[$name]) && count($this->typeExtensions[$name]) > 0;
101+
return isset($this->typeExtensions[$name]) && \count($this->typeExtensions[$name]) > 0;
102102
}
103103

104104
/**
@@ -156,7 +156,7 @@ private function initTypes()
156156
throw new UnexpectedTypeException($type, 'Symfony\Component\Form\FormTypeInterface');
157157
}
158158

159-
$this->types[get_class($type)] = $type;
159+
$this->types[\get_class($type)] = $type;
160160
}
161161
}
162162

AbstractRendererEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */
4949
$cacheKey = $view->vars[self::CACHE_KEY_VAR];
5050

5151
// Do not cast, as casting turns objects into arrays of properties
52-
$this->themes[$cacheKey] = is_array($themes) ? $themes : array($themes);
52+
$this->themes[$cacheKey] = \is_array($themes) ? $themes : array($themes);
5353

54-
$args = func_get_args();
54+
$args = \func_get_args();
5555
$this->useDefaultThemes[$cacheKey] = isset($args[2]) ? (bool) $args[2] : true;
5656

5757
// Unset instead of resetting to an empty array, in order to allow

AbstractType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function configureOptions(OptionsResolver $resolver)
5252
*/
5353
public function getBlockPrefix()
5454
{
55-
return StringUtil::fqcnToBlockPrefix(get_class($this));
55+
return StringUtil::fqcnToBlockPrefix(\get_class($this));
5656
}
5757

5858
/**

CallbackTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(callable $transform, callable $reverseTransform)
4141
*/
4242
public function transform($data)
4343
{
44-
return call_user_func($this->transform, $data);
44+
return \call_user_func($this->transform, $data);
4545
}
4646

4747
/**
@@ -57,6 +57,6 @@ public function transform($data)
5757
*/
5858
public function reverseTransform($data)
5959
{
60-
return call_user_func($this->reverseTransform, $data);
60+
return \call_user_func($this->reverseTransform, $data);
6161
}
6262
}

ChoiceList/ArrayChoiceList.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function getValuesForChoices(array $choices)
155155
$givenValues = array();
156156

157157
foreach ($choices as $i => $givenChoice) {
158-
$givenValues[$i] = (string) call_user_func($this->valueCallback, $givenChoice);
158+
$givenValues[$i] = (string) \call_user_func($this->valueCallback, $givenChoice);
159159
}
160160

161161
return array_intersect($givenValues, array_keys($this->choices));
@@ -196,13 +196,13 @@ protected function flatten(array $choices, $value, &$choicesByValues, &$keysByVa
196196
}
197197

198198
foreach ($choices as $key => $choice) {
199-
if (is_array($choice)) {
199+
if (\is_array($choice)) {
200200
$this->flatten($choice, $value, $choicesByValues, $keysByValues, $structuredValues[$key]);
201201

202202
continue;
203203
}
204204

205-
$choiceValue = (string) call_user_func($value, $choice);
205+
$choiceValue = (string) \call_user_func($value, $choice);
206206
$choicesByValues[$choiceValue] = $choice;
207207
$keysByValues[$choiceValue] = $key;
208208
$structuredValues[$key] = $choiceValue;
@@ -222,7 +222,7 @@ protected function flatten(array $choices, $value, &$choicesByValues, &$keysByVa
222222
private function castableToString(array $choices, array &$cache = array())
223223
{
224224
foreach ($choices as $choice) {
225-
if (is_array($choice)) {
225+
if (\is_array($choice)) {
226226
if (!$this->castableToString($choice, $cache)) {
227227
return false;
228228
}

ChoiceList/Factory/CachingFactoryDecorator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ class CachingFactoryDecorator implements ChoiceListFactoryInterface
4949
*/
5050
public static function generateHash($value, $namespace = '')
5151
{
52-
if (is_object($value)) {
52+
if (\is_object($value)) {
5353
$value = spl_object_hash($value);
54-
} elseif (is_array($value)) {
54+
} elseif (\is_array($value)) {
5555
array_walk_recursive($value, function (&$v) {
56-
if (is_object($v)) {
56+
if (\is_object($v)) {
5757
$v = spl_object_hash($v);
5858
}
5959
});
@@ -77,7 +77,7 @@ private static function flatten(array $array, &$output)
7777
}
7878

7979
foreach ($array as $key => $value) {
80-
if (is_array($value)) {
80+
if (\is_array($value)) {
8181
self::flatten($value, $output);
8282
continue;
8383
}

ChoiceList/Factory/DefaultChoiceListFactory.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
5252
$choices = $list->getChoices();
5353
$keys = $list->getOriginalKeys();
5454

55-
if (!is_callable($preferredChoices) && !empty($preferredChoices)) {
55+
if (!\is_callable($preferredChoices) && !empty($preferredChoices)) {
5656
$preferredChoices = function ($choice) use ($preferredChoices) {
57-
return in_array($choice, $preferredChoices, true);
57+
return \in_array($choice, $preferredChoices, true);
5858
};
5959
}
6060

@@ -66,7 +66,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
6666
// If $groupBy is a callable, choices are added to the group with the
6767
// name returned by the callable. If the callable returns null, the
6868
// choice is not added to any group
69-
if (is_callable($groupBy)) {
69+
if (\is_callable($groupBy)) {
7070
foreach ($choices as $value => $choice) {
7171
self::addChoiceViewGroupedBy(
7272
$groupBy,
@@ -99,13 +99,13 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
9999
// Remove any empty group view that may have been created by
100100
// addChoiceViewGroupedBy()
101101
foreach ($preferredViews as $key => $view) {
102-
if ($view instanceof ChoiceGroupView && 0 === count($view->choices)) {
102+
if ($view instanceof ChoiceGroupView && 0 === \count($view->choices)) {
103103
unset($preferredViews[$key]);
104104
}
105105
}
106106

107107
foreach ($otherViews as $key => $view) {
108-
if ($view instanceof ChoiceGroupView && 0 === count($view->choices)) {
108+
if ($view instanceof ChoiceGroupView && 0 === \count($view->choices)) {
109109
unset($otherViews[$key]);
110110
}
111111
}
@@ -118,7 +118,7 @@ private static function addChoiceView($choice, $value, $label, $keys, &$index, $
118118
// $value may be an integer or a string, since it's stored in the array
119119
// keys. We want to guarantee it's a string though.
120120
$key = $keys[$value];
121-
$nextIndex = is_int($index) ? $index++ : call_user_func($index, $choice, $key, $value);
121+
$nextIndex = \is_int($index) ? $index++ : \call_user_func($index, $choice, $key, $value);
122122

123123
// BC normalize label to accept a false value
124124
if (null === $label) {
@@ -127,7 +127,7 @@ private static function addChoiceView($choice, $value, $label, $keys, &$index, $
127127
} elseif (false !== $label) {
128128
// If "choice_label" is set to false and "expanded" is true, the value false
129129
// should be passed on to the "label" option of the checkboxes/radio buttons
130-
$dynamicLabel = call_user_func($label, $choice, $key, $value);
130+
$dynamicLabel = \call_user_func($label, $choice, $key, $value);
131131
$label = false === $dynamicLabel ? false : (string) $dynamicLabel;
132132
}
133133

@@ -137,11 +137,11 @@ private static function addChoiceView($choice, $value, $label, $keys, &$index, $
137137
$label,
138138
// The attributes may be a callable or a mapping from choice indices
139139
// to nested arrays
140-
is_callable($attr) ? call_user_func($attr, $choice, $key, $value) : (isset($attr[$key]) ? $attr[$key] : array())
140+
\is_callable($attr) ? \call_user_func($attr, $choice, $key, $value) : (isset($attr[$key]) ? $attr[$key] : array())
141141
);
142142

143143
// $isPreferred may be null if no choices are preferred
144-
if ($isPreferred && call_user_func($isPreferred, $choice, $key, $value)) {
144+
if ($isPreferred && \call_user_func($isPreferred, $choice, $key, $value)) {
145145
$preferredViews[$nextIndex] = $view;
146146
} else {
147147
$otherViews[$nextIndex] = $view;
@@ -156,7 +156,7 @@ private static function addChoiceViewsGroupedBy($groupBy, $label, $choices, $key
156156
}
157157

158158
// Add the contents of groups to new ChoiceGroupView instances
159-
if (is_array($value)) {
159+
if (\is_array($value)) {
160160
$preferredViewsForGroup = array();
161161
$otherViewsForGroup = array();
162162

@@ -172,11 +172,11 @@ private static function addChoiceViewsGroupedBy($groupBy, $label, $choices, $key
172172
$otherViewsForGroup
173173
);
174174

175-
if (count($preferredViewsForGroup) > 0) {
175+
if (\count($preferredViewsForGroup) > 0) {
176176
$preferredViews[$key] = new ChoiceGroupView($key, $preferredViewsForGroup);
177177
}
178178

179-
if (count($otherViewsForGroup) > 0) {
179+
if (\count($otherViewsForGroup) > 0) {
180180
$otherViews[$key] = new ChoiceGroupView($key, $otherViewsForGroup);
181181
}
182182

@@ -200,7 +200,7 @@ private static function addChoiceViewsGroupedBy($groupBy, $label, $choices, $key
200200

201201
private static function addChoiceViewGroupedBy($groupBy, $choice, $value, $label, $keys, &$index, $attr, $isPreferred, &$preferredViews, &$otherViews)
202202
{
203-
$groupLabel = call_user_func($groupBy, $choice, $keys[$value], $value);
203+
$groupLabel = \call_user_func($groupBy, $choice, $keys[$value], $value);
204204

205205
if (null === $groupLabel) {
206206
// If the callable returns null, don't group the choice

ChoiceList/Factory/PropertyAccessDecorator.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ public function getDecoratedFactory()
7171
*/
7272
public function createListFromChoices($choices, $value = null)
7373
{
74-
if (is_string($value) && !is_callable($value)) {
74+
if (\is_string($value) && !\is_callable($value)) {
7575
$value = new PropertyPath($value);
76-
} elseif (is_string($value) && is_callable($value)) {
76+
} elseif (\is_string($value) && \is_callable($value)) {
7777
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
7878
}
7979

@@ -84,7 +84,7 @@ public function createListFromChoices($choices, $value = null)
8484
// when such values are passed to
8585
// ChoiceListInterface::getValuesForChoices(). Handle this case
8686
// so that the call to getValue() doesn't break.
87-
if (is_object($choice) || is_array($choice)) {
87+
if (\is_object($choice) || \is_array($choice)) {
8888
return $accessor->getValue($choice, $value);
8989
}
9090
};
@@ -104,9 +104,9 @@ public function createListFromChoices($choices, $value = null)
104104
*/
105105
public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null)
106106
{
107-
if (is_string($value) && !is_callable($value)) {
107+
if (\is_string($value) && !\is_callable($value)) {
108108
$value = new PropertyPath($value);
109-
} elseif (is_string($value) && is_callable($value)) {
109+
} elseif (\is_string($value) && \is_callable($value)) {
110110
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
111111
}
112112

@@ -117,7 +117,7 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
117117
// when such values are passed to
118118
// ChoiceListInterface::getValuesForChoices(). Handle this case
119119
// so that the call to getValue() doesn't break.
120-
if (is_object($choice) || is_array($choice)) {
120+
if (\is_object($choice) || \is_array($choice)) {
121121
return $accessor->getValue($choice, $value);
122122
}
123123
};
@@ -142,9 +142,9 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
142142
{
143143
$accessor = $this->propertyAccessor;
144144

145-
if (is_string($label) && !is_callable($label)) {
145+
if (\is_string($label) && !\is_callable($label)) {
146146
$label = new PropertyPath($label);
147-
} elseif (is_string($label) && is_callable($label)) {
147+
} elseif (\is_string($label) && \is_callable($label)) {
148148
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
149149
}
150150

@@ -154,9 +154,9 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
154154
};
155155
}
156156

157-
if (is_string($preferredChoices) && !is_callable($preferredChoices)) {
157+
if (\is_string($preferredChoices) && !\is_callable($preferredChoices)) {
158158
$preferredChoices = new PropertyPath($preferredChoices);
159-
} elseif (is_string($preferredChoices) && is_callable($preferredChoices)) {
159+
} elseif (\is_string($preferredChoices) && \is_callable($preferredChoices)) {
160160
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
161161
}
162162

@@ -171,9 +171,9 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
171171
};
172172
}
173173

174-
if (is_string($index) && !is_callable($index)) {
174+
if (\is_string($index) && !\is_callable($index)) {
175175
$index = new PropertyPath($index);
176-
} elseif (is_string($index) && is_callable($index)) {
176+
} elseif (\is_string($index) && \is_callable($index)) {
177177
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
178178
}
179179

@@ -183,9 +183,9 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
183183
};
184184
}
185185

186-
if (is_string($groupBy) && !is_callable($groupBy)) {
186+
if (\is_string($groupBy) && !\is_callable($groupBy)) {
187187
$groupBy = new PropertyPath($groupBy);
188-
} elseif (is_string($groupBy) && is_callable($groupBy)) {
188+
} elseif (\is_string($groupBy) && \is_callable($groupBy)) {
189189
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
190190
}
191191

@@ -199,9 +199,9 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
199199
};
200200
}
201201

202-
if (is_string($attr) && !is_callable($attr)) {
202+
if (\is_string($attr) && !\is_callable($attr)) {
203203
$attr = new PropertyPath($attr);
204-
} elseif (is_string($attr) && is_callable($attr)) {
204+
} elseif (\is_string($attr) && \is_callable($attr)) {
205205
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
206206
}
207207

ChoiceList/Loader/CallbackChoiceLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function loadChoiceList($value = null)
4646
return $this->choiceList;
4747
}
4848

49-
return $this->choiceList = new ArrayChoiceList(call_user_func($this->callback), $value);
49+
return $this->choiceList = new ArrayChoiceList(\call_user_func($this->callback), $value);
5050
}
5151

5252
/**

Command/DebugCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
111111
$object = $resolvedType->getOptionsResolver();
112112

113113
if (!$object->isDefined($option)) {
114-
$message = sprintf('Option "%s" is not defined in "%s".', $option, get_class($resolvedType->getInnerType()));
114+
$message = sprintf('Option "%s" is not defined in "%s".', $option, \get_class($resolvedType->getInnerType()));
115115

116116
if ($alternatives = $this->findAlternatives($option, $object->getDefinedOptions())) {
117-
if (1 == count($alternatives)) {
117+
if (1 == \count($alternatives)) {
118118
$message .= "\n\nDid you mean this?\n ";
119119
} else {
120120
$message .= "\n\nDid you mean one of these?\n ";
@@ -147,12 +147,12 @@ private function getFqcnTypeClass(InputInterface $input, SymfonyStyle $io, $shor
147147
}
148148
}
149149

150-
if (0 === $count = count($classes)) {
150+
if (0 === $count = \count($classes)) {
151151
$message = sprintf("Could not find type \"%s\" into the following namespaces:\n %s", $shortClassName, implode("\n ", $this->namespaces));
152152

153153
$allTypes = array_merge($this->getCoreTypes(), $this->types);
154154
if ($alternatives = $this->findAlternatives($shortClassName, $allTypes)) {
155-
if (1 == count($alternatives)) {
155+
if (1 == \count($alternatives)) {
156156
$message .= "\n\nDid you mean this?\n ";
157157
} else {
158158
$message .= "\n\nDid you mean one of these?\n ";
@@ -178,7 +178,7 @@ private function getCoreTypes()
178178
$loadTypesRefMethod = (new \ReflectionObject($coreExtension))->getMethod('loadTypes');
179179
$loadTypesRefMethod->setAccessible(true);
180180
$coreTypes = $loadTypesRefMethod->invoke($coreExtension);
181-
$coreTypes = array_map(function (FormTypeInterface $type) { return get_class($type); }, $coreTypes);
181+
$coreTypes = array_map(function (FormTypeInterface $type) { return \get_class($type); }, $coreTypes);
182182
sort($coreTypes);
183183

184184
return $coreTypes;
@@ -189,7 +189,7 @@ private function findAlternatives($name, array $collection)
189189
$alternatives = array();
190190
foreach ($collection as $item) {
191191
$lev = levenshtein($name, $item);
192-
if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
192+
if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
193193
$alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
194194
}
195195
}

0 commit comments

Comments
 (0)