Skip to content

Commit 6a5aad6

Browse files
Merge branch '4.0' into 4.1
* 4.0: 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 62da4ba + 80a880c commit 6a5aad6

File tree

88 files changed

+249
-249
lines changed

Some content is hidden

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

88 files changed

+249
-249
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ 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
$this->useDefaultThemes[$cacheKey] = (bool) $useDefaultThemes;
5454

5555
// 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: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function getDecoratedFactory()
7171
*/
7272
public function createListFromChoices($choices, $value = null)
7373
{
74-
if (is_string($value)) {
74+
if (\is_string($value)) {
7575
$value = new PropertyPath($value);
7676
}
7777

@@ -82,7 +82,7 @@ public function createListFromChoices($choices, $value = null)
8282
// when such values are passed to
8383
// ChoiceListInterface::getValuesForChoices(). Handle this case
8484
// so that the call to getValue() doesn't break.
85-
if (is_object($choice) || is_array($choice)) {
85+
if (\is_object($choice) || \is_array($choice)) {
8686
return $accessor->getValue($choice, $value);
8787
}
8888
};
@@ -102,7 +102,7 @@ public function createListFromChoices($choices, $value = null)
102102
*/
103103
public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null)
104104
{
105-
if (is_string($value)) {
105+
if (\is_string($value)) {
106106
$value = new PropertyPath($value);
107107
}
108108

@@ -113,7 +113,7 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
113113
// when such values are passed to
114114
// ChoiceListInterface::getValuesForChoices(). Handle this case
115115
// so that the call to getValue() doesn't break.
116-
if (is_object($choice) || is_array($choice)) {
116+
if (\is_object($choice) || \is_array($choice)) {
117117
return $accessor->getValue($choice, $value);
118118
}
119119
};
@@ -138,7 +138,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
138138
{
139139
$accessor = $this->propertyAccessor;
140140

141-
if (is_string($label)) {
141+
if (\is_string($label)) {
142142
$label = new PropertyPath($label);
143143
}
144144

@@ -148,7 +148,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
148148
};
149149
}
150150

151-
if (is_string($preferredChoices)) {
151+
if (\is_string($preferredChoices)) {
152152
$preferredChoices = new PropertyPath($preferredChoices);
153153
}
154154

@@ -163,7 +163,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
163163
};
164164
}
165165

166-
if (is_string($index)) {
166+
if (\is_string($index)) {
167167
$index = new PropertyPath($index);
168168
}
169169

@@ -173,7 +173,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
173173
};
174174
}
175175

176-
if (is_string($groupBy)) {
176+
if (\is_string($groupBy)) {
177177
$groupBy = new PropertyPath($groupBy);
178178
}
179179

@@ -187,7 +187,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
187187
};
188188
}
189189

190-
if (is_string($attr)) {
190+
if (\is_string($attr)) {
191191
$attr = new PropertyPath($attr);
192192
}
193193

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)