Skip to content

Commit 15579a6

Browse files
committed
Enable the fixer enforcing fully-qualified calls for compiler-optimized functions
1 parent cf9afb0 commit 15579a6

File tree

95 files changed

+287
-287
lines changed

Some content is hidden

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

95 files changed

+287
-287
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
/**
@@ -157,7 +157,7 @@ private function initTypes()
157157
}
158158

159159
// Since Symfony 3.0 types are identified by their FQCN
160-
$fqcn = get_class($type);
160+
$fqcn = \get_class($type);
161161
$legacyName = $type->getName();
162162

163163
$this->types[$fqcn] = $type;

AbstractRendererEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function setTheme(FormView $view, $themes)
4848
$cacheKey = $view->vars[self::CACHE_KEY_VAR];
4949

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

5353
// Unset instead of resetting to an empty array, in order to allow
5454
// implementations (like TwigRendererEngine) to check whether $cacheKey

AbstractType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function finishView(FormView $view, FormInterface $form, array $options)
4747
public function setDefaultOptions(OptionsResolverInterface $resolver)
4848
{
4949
if (!$resolver instanceof OptionsResolver) {
50-
throw new \InvalidArgumentException(sprintf('Custom resolver "%s" must extend "Symfony\Component\OptionsResolver\OptionsResolver".', get_class($resolver)));
50+
throw new \InvalidArgumentException(sprintf('Custom resolver "%s" must extend "Symfony\Component\OptionsResolver\OptionsResolver".', \get_class($resolver)));
5151
}
5252

5353
$this->configureOptions($resolver);
@@ -68,7 +68,7 @@ public function configureOptions(OptionsResolver $resolver)
6868
public function getName()
6969
{
7070
// As of Symfony 2.8, the name defaults to the fully-qualified class name
71-
return get_class($this);
71+
return \get_class($this);
7272
}
7373

7474
/**
@@ -81,7 +81,7 @@ public function getName()
8181
*/
8282
public function getBlockPrefix()
8383
{
84-
$fqcn = get_class($this);
84+
$fqcn = \get_class($this);
8585
$name = $this->getName();
8686

8787
// For BC: Use the name as block prefix if one is set

AbstractTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function finishView(FormView $view, FormInterface $form, array $options)
4646
public function setDefaultOptions(OptionsResolverInterface $resolver)
4747
{
4848
if (!$resolver instanceof OptionsResolver) {
49-
throw new \InvalidArgumentException(sprintf('Custom resolver "%s" must extend "Symfony\Component\OptionsResolver\OptionsResolver".', get_class($resolver)));
49+
throw new \InvalidArgumentException(sprintf('Custom resolver "%s" must extend "Symfony\Component\OptionsResolver\OptionsResolver".', \get_class($resolver)));
5050
}
5151

5252
$this->configureOptions($resolver);

CallbackTransformer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class CallbackTransformer implements DataTransformerInterface
2727
*/
2828
public function __construct($transform, $reverseTransform)
2929
{
30-
if (!is_callable($transform)) {
30+
if (!\is_callable($transform)) {
3131
throw new \InvalidArgumentException('Argument 1 should be a callable');
3232
}
33-
if (!is_callable($reverseTransform)) {
33+
if (!\is_callable($reverseTransform)) {
3434
throw new \InvalidArgumentException('Argument 2 should be a callable');
3535
}
3636

@@ -50,7 +50,7 @@ public function __construct($transform, $reverseTransform)
5050
*/
5151
public function transform($data)
5252
{
53-
return call_user_func($this->transform, $data);
53+
return \call_user_func($this->transform, $data);
5454
}
5555

5656
/**
@@ -66,6 +66,6 @@ public function transform($data)
6666
*/
6767
public function reverseTransform($data)
6868
{
69-
return call_user_func($this->reverseTransform, $data);
69+
return \call_user_func($this->reverseTransform, $data);
7070
}
7171
}

ChoiceList/ArrayChoiceList.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class ArrayChoiceList implements ChoiceListInterface
6666
*/
6767
public function __construct($choices, $value = null)
6868
{
69-
if (null !== $value && !is_callable($value)) {
69+
if (null !== $value && !\is_callable($value)) {
7070
throw new UnexpectedTypeException($value, 'null or callable');
7171
}
7272

@@ -161,7 +161,7 @@ public function getValuesForChoices(array $choices)
161161
$givenValues = array();
162162

163163
foreach ($choices as $i => $givenChoice) {
164-
$givenValues[$i] = (string) call_user_func($this->valueCallback, $givenChoice);
164+
$givenValues[$i] = (string) \call_user_func($this->valueCallback, $givenChoice);
165165
}
166166

167167
return array_intersect($givenValues, array_keys($this->choices));
@@ -202,13 +202,13 @@ protected function flatten(array $choices, $value, &$choicesByValues, &$keysByVa
202202
}
203203

204204
foreach ($choices as $key => $choice) {
205-
if (is_array($choice)) {
205+
if (\is_array($choice)) {
206206
$this->flatten($choice, $value, $choicesByValues, $keysByValues, $structuredValues[$key]);
207207

208208
continue;
209209
}
210210

211-
$choiceValue = (string) call_user_func($value, $choice);
211+
$choiceValue = (string) \call_user_func($value, $choice);
212212
$choicesByValues[$choiceValue] = $choice;
213213
$keysByValues[$choiceValue] = $key;
214214
$structuredValues[$key] = $choiceValue;
@@ -228,7 +228,7 @@ protected function flatten(array $choices, $value, &$choicesByValues, &$keysByVa
228228
private function castableToString(array $choices, array &$cache = array())
229229
{
230230
foreach ($choices as $choice) {
231-
if (is_array($choice)) {
231+
if (\is_array($choice)) {
232232
if (!$this->castableToString($choice, $cache)) {
233233
return false;
234234
}

ChoiceList/ArrayKeyChoiceList.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ public static function toArrayKey($choice)
7474
if (!is_scalar($choice) && null !== $choice) {
7575
throw new InvalidArgumentException(sprintf(
7676
'The value of type "%s" cannot be converted to a valid array key.',
77-
gettype($choice)
77+
\gettype($choice)
7878
));
7979
}
8080

81-
if (is_bool($choice) || (string) (int) $choice === (string) $choice) {
81+
if (\is_bool($choice) || (string) (int) $choice === (string) $choice) {
8282
return (int) $choice;
8383
}
8484

@@ -176,13 +176,13 @@ protected function flatten(array $choices, $value, &$choicesByValues, &$keysByVa
176176
}
177177

178178
foreach ($choices as $choice => $key) {
179-
if (is_array($key)) {
179+
if (\is_array($key)) {
180180
$this->flatten($key, $value, $choicesByValues, $keysByValues, $structuredValues[$choice]);
181181

182182
continue;
183183
}
184184

185-
$choiceValue = (string) call_user_func($value, $choice);
185+
$choiceValue = (string) \call_user_func($value, $choice);
186186
$choicesByValues[$choiceValue] = $choice;
187187
$keysByValues[$choiceValue] = $key;
188188
$structuredValues[$key] = $choiceValue;

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
@@ -87,9 +87,9 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
8787
$choices = $list->getChoices();
8888
$keys = $list->getOriginalKeys();
8989

90-
if (!is_callable($preferredChoices) && !empty($preferredChoices)) {
90+
if (!\is_callable($preferredChoices) && !empty($preferredChoices)) {
9191
$preferredChoices = function ($choice) use ($preferredChoices) {
92-
return in_array($choice, $preferredChoices, true);
92+
return \in_array($choice, $preferredChoices, true);
9393
};
9494
}
9595

@@ -101,7 +101,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
101101
// If $groupBy is a callable, choices are added to the group with the
102102
// name returned by the callable. If the callable returns null, the
103103
// choice is not added to any group
104-
if (is_callable($groupBy)) {
104+
if (\is_callable($groupBy)) {
105105
foreach ($choices as $value => $choice) {
106106
self::addChoiceViewGroupedBy(
107107
$groupBy,
@@ -134,13 +134,13 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
134134
// Remove any empty group view that may have been created by
135135
// addChoiceViewGroupedBy()
136136
foreach ($preferredViews as $key => $view) {
137-
if ($view instanceof ChoiceGroupView && 0 === count($view->choices)) {
137+
if ($view instanceof ChoiceGroupView && 0 === \count($view->choices)) {
138138
unset($preferredViews[$key]);
139139
}
140140
}
141141

142142
foreach ($otherViews as $key => $view) {
143-
if ($view instanceof ChoiceGroupView && 0 === count($view->choices)) {
143+
if ($view instanceof ChoiceGroupView && 0 === \count($view->choices)) {
144144
unset($otherViews[$key]);
145145
}
146146
}
@@ -153,7 +153,7 @@ private static function addChoiceView($choice, $value, $label, $keys, &$index, $
153153
// $value may be an integer or a string, since it's stored in the array
154154
// keys. We want to guarantee it's a string though.
155155
$key = $keys[$value];
156-
$nextIndex = is_int($index) ? $index++ : call_user_func($index, $choice, $key, $value);
156+
$nextIndex = \is_int($index) ? $index++ : \call_user_func($index, $choice, $key, $value);
157157

158158
// BC normalize label to accept a false value
159159
if (null === $label) {
@@ -162,7 +162,7 @@ private static function addChoiceView($choice, $value, $label, $keys, &$index, $
162162
} elseif (false !== $label) {
163163
// If "choice_label" is set to false and "expanded" is true, the value false
164164
// should be passed on to the "label" option of the checkboxes/radio buttons
165-
$dynamicLabel = call_user_func($label, $choice, $key, $value);
165+
$dynamicLabel = \call_user_func($label, $choice, $key, $value);
166166
$label = false === $dynamicLabel ? false : (string) $dynamicLabel;
167167
}
168168

@@ -172,11 +172,11 @@ private static function addChoiceView($choice, $value, $label, $keys, &$index, $
172172
$label,
173173
// The attributes may be a callable or a mapping from choice indices
174174
// to nested arrays
175-
is_callable($attr) ? call_user_func($attr, $choice, $key, $value) : (isset($attr[$key]) ? $attr[$key] : array())
175+
\is_callable($attr) ? \call_user_func($attr, $choice, $key, $value) : (isset($attr[$key]) ? $attr[$key] : array())
176176
);
177177

178178
// $isPreferred may be null if no choices are preferred
179-
if ($isPreferred && call_user_func($isPreferred, $choice, $key, $value)) {
179+
if ($isPreferred && \call_user_func($isPreferred, $choice, $key, $value)) {
180180
$preferredViews[$nextIndex] = $view;
181181
} else {
182182
$otherViews[$nextIndex] = $view;
@@ -191,7 +191,7 @@ private static function addChoiceViewsGroupedBy($groupBy, $label, $choices, $key
191191
}
192192

193193
// Add the contents of groups to new ChoiceGroupView instances
194-
if (is_array($value)) {
194+
if (\is_array($value)) {
195195
$preferredViewsForGroup = array();
196196
$otherViewsForGroup = array();
197197

@@ -207,11 +207,11 @@ private static function addChoiceViewsGroupedBy($groupBy, $label, $choices, $key
207207
$otherViewsForGroup
208208
);
209209

210-
if (count($preferredViewsForGroup) > 0) {
210+
if (\count($preferredViewsForGroup) > 0) {
211211
$preferredViews[$key] = new ChoiceGroupView($key, $preferredViewsForGroup);
212212
}
213213

214-
if (count($otherViewsForGroup) > 0) {
214+
if (\count($otherViewsForGroup) > 0) {
215215
$otherViews[$key] = new ChoiceGroupView($key, $otherViewsForGroup);
216216
}
217217

@@ -235,7 +235,7 @@ private static function addChoiceViewsGroupedBy($groupBy, $label, $choices, $key
235235

236236
private static function addChoiceViewGroupedBy($groupBy, $choice, $value, $label, $keys, &$index, $attr, $isPreferred, &$preferredViews, &$otherViews)
237237
{
238-
$groupLabel = call_user_func($groupBy, $choice, $keys[$value], $value);
238+
$groupLabel = \call_user_func($groupBy, $choice, $keys[$value], $value);
239239

240240
if (null === $groupLabel) {
241241
// 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) && !is_callable($value)) {
74+
if (\is_string($value) && !\is_callable($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
};
@@ -121,7 +121,7 @@ public function createListFromFlippedChoices($choices, $value = null, $triggerDe
121121
*/
122122
public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null)
123123
{
124-
if (is_string($value) && !is_callable($value)) {
124+
if (\is_string($value) && !\is_callable($value)) {
125125
$value = new PropertyPath($value);
126126
}
127127

@@ -132,7 +132,7 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
132132
// when such values are passed to
133133
// ChoiceListInterface::getValuesForChoices(). Handle this case
134134
// so that the call to getValue() doesn't break.
135-
if (is_object($choice) || is_array($choice)) {
135+
if (\is_object($choice) || \is_array($choice)) {
136136
return $accessor->getValue($choice, $value);
137137
}
138138
};
@@ -157,7 +157,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
157157
{
158158
$accessor = $this->propertyAccessor;
159159

160-
if (is_string($label) && !is_callable($label)) {
160+
if (\is_string($label) && !\is_callable($label)) {
161161
$label = new PropertyPath($label);
162162
}
163163

@@ -167,7 +167,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
167167
};
168168
}
169169

170-
if (is_string($preferredChoices) && !is_callable($preferredChoices)) {
170+
if (\is_string($preferredChoices) && !\is_callable($preferredChoices)) {
171171
$preferredChoices = new PropertyPath($preferredChoices);
172172
}
173173

@@ -182,7 +182,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
182182
};
183183
}
184184

185-
if (is_string($index) && !is_callable($index)) {
185+
if (\is_string($index) && !\is_callable($index)) {
186186
$index = new PropertyPath($index);
187187
}
188188

@@ -192,7 +192,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
192192
};
193193
}
194194

195-
if (is_string($groupBy) && !is_callable($groupBy)) {
195+
if (\is_string($groupBy) && !\is_callable($groupBy)) {
196196
$groupBy = new PropertyPath($groupBy);
197197
}
198198

@@ -206,7 +206,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
206206
};
207207
}
208208

209-
if (is_string($attr) && !is_callable($attr)) {
209+
if (\is_string($attr) && !\is_callable($attr)) {
210210
$attr = new PropertyPath($attr);
211211
}
212212

0 commit comments

Comments
 (0)