Skip to content

Commit ebd4ea7

Browse files
committed
Enable the fixer enforcing fully-qualified calls for compiler-optimized functions
1 parent 157f216 commit ebd4ea7

File tree

73 files changed

+233
-233
lines changed

Some content is hidden

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

73 files changed

+233
-233
lines changed

Constraint.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static function getErrorName($errorCode)
7373
throw new InvalidArgumentException(sprintf(
7474
'The error code "%s" does not exist for constraint of type "%s".',
7575
$errorCode,
76-
get_called_class()
76+
\get_called_class()
7777
));
7878
}
7979

@@ -116,15 +116,15 @@ public function __construct($options = null)
116116
// The "groups" option is added to the object lazily
117117
$knownOptions['groups'] = true;
118118

119-
if (is_array($options) && count($options) >= 1 && isset($options['value']) && !property_exists($this, 'value')) {
119+
if (\is_array($options) && \count($options) >= 1 && isset($options['value']) && !property_exists($this, 'value')) {
120120
$options[$this->getDefaultOption()] = $options['value'];
121121
unset($options['value']);
122122
}
123123

124-
if (is_array($options)) {
124+
if (\is_array($options)) {
125125
reset($options);
126126
}
127-
if (is_array($options) && count($options) > 0 && is_string(key($options))) {
127+
if (\is_array($options) && \count($options) > 0 && \is_string(key($options))) {
128128
foreach ($options as $option => $value) {
129129
if (array_key_exists($option, $knownOptions)) {
130130
$this->$option = $value;
@@ -133,12 +133,12 @@ public function __construct($options = null)
133133
$invalidOptions[] = $option;
134134
}
135135
}
136-
} elseif (null !== $options && !(is_array($options) && 0 === count($options))) {
136+
} elseif (null !== $options && !(\is_array($options) && 0 === \count($options))) {
137137
$option = $this->getDefaultOption();
138138

139139
if (null === $option) {
140140
throw new ConstraintDefinitionException(
141-
sprintf('No default option is configured for constraint %s', get_class($this))
141+
sprintf('No default option is configured for constraint %s', \get_class($this))
142142
);
143143
}
144144

@@ -150,16 +150,16 @@ public function __construct($options = null)
150150
}
151151
}
152152

153-
if (count($invalidOptions) > 0) {
153+
if (\count($invalidOptions) > 0) {
154154
throw new InvalidOptionsException(
155-
sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), get_class($this)),
155+
sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), \get_class($this)),
156156
$invalidOptions
157157
);
158158
}
159159

160-
if (count($missingOptions) > 0) {
160+
if (\count($missingOptions) > 0) {
161161
throw new MissingOptionsException(
162-
sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), get_class($this)),
162+
sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), \get_class($this)),
163163
array_keys($missingOptions)
164164
);
165165
}
@@ -185,7 +185,7 @@ public function __set($option, $value)
185185
return;
186186
}
187187

188-
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option));
188+
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), array($option));
189189
}
190190

191191
/**
@@ -211,7 +211,7 @@ public function __get($option)
211211
return $this->groups;
212212
}
213213

214-
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option));
214+
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), array($option));
215215
}
216216

217217
/**
@@ -231,7 +231,7 @@ public function __isset($option)
231231
*/
232232
public function addImplicitGroupName($group)
233233
{
234-
if (in_array(self::DEFAULT_GROUP, $this->groups) && !in_array($group, $this->groups)) {
234+
if (\in_array(self::DEFAULT_GROUP, $this->groups) && !\in_array($group, $this->groups)) {
235235
$this->groups[] = $group;
236236
}
237237
}
@@ -274,7 +274,7 @@ public function getRequiredOptions()
274274
*/
275275
public function validatedBy()
276276
{
277-
return get_class($this).'Validator';
277+
return \get_class($this).'Validator';
278278
}
279279

280280
/**

ConstraintValidator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function buildViolationInContext(ExecutionContextInterface $context, $
105105
*/
106106
protected function formatTypeOf($value)
107107
{
108-
return is_object($value) ? get_class($value) : gettype($value);
108+
return \is_object($value) ? \get_class($value) : \gettype($value);
109109
}
110110

111111
/**
@@ -154,23 +154,23 @@ protected function formatValue($value, $format = 0)
154154
return $value->format('Y-m-d H:i:s');
155155
}
156156

157-
if (is_object($value)) {
157+
if (\is_object($value)) {
158158
if (($format & self::OBJECT_TO_STRING) && method_exists($value, '__toString')) {
159159
return $value->__toString();
160160
}
161161

162162
return 'object';
163163
}
164164

165-
if (is_array($value)) {
165+
if (\is_array($value)) {
166166
return 'array';
167167
}
168168

169-
if (is_string($value)) {
169+
if (\is_string($value)) {
170170
return '"'.$value.'"';
171171
}
172172

173-
if (is_resource($value)) {
173+
if (\is_resource($value)) {
174174
return 'resource';
175175
}
176176

ConstraintViolation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ public function __construct($message, $messageTemplate, array $parameters, $root
7070
*/
7171
public function __toString()
7272
{
73-
if (is_object($this->root)) {
74-
$class = 'Object('.get_class($this->root).')';
75-
} elseif (is_array($this->root)) {
73+
if (\is_object($this->root)) {
74+
$class = 'Object('.\get_class($this->root).')';
75+
} elseif (\is_array($this->root)) {
7676
$class = 'Array';
7777
} else {
7878
$class = (string) $this->root;

ConstraintViolationList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function getIterator()
120120
*/
121121
public function count()
122122
{
123-
return count($this->violations);
123+
return \count($this->violations);
124124
}
125125

126126
/**

Constraints/AbstractComparison.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ public function __construct($options = null)
3434
$options = array();
3535
}
3636

37-
if (is_array($options) && !isset($options['value'])) {
37+
if (\is_array($options) && !isset($options['value'])) {
3838
throw new ConstraintDefinitionException(sprintf(
3939
'The %s constraint requires the "value" option to be set.',
40-
get_class($this)
40+
\get_class($this)
4141
));
4242
}
4343

Constraints/AbstractComparisonValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function validate($value, Constraint $constraint)
4343
// This allows to compare with any date/time value supported by
4444
// the DateTime constructor:
4545
// http://php.net/manual/en/datetime.formats.php
46-
if (is_string($comparedValue)) {
46+
if (\is_string($comparedValue)) {
4747
if ($value instanceof \DateTimeImmutable) {
4848
// If $value is immutable, convert the compared value to a
4949
// DateTimeImmutable too

Constraints/AllValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function validate($value, Constraint $constraint)
3434
return;
3535
}
3636

37-
if (!is_array($value) && !$value instanceof \Traversable) {
37+
if (!\is_array($value) && !$value instanceof \Traversable) {
3838
throw new UnexpectedTypeException($value, 'array or Traversable');
3939
}
4040

Constraints/BicValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function validate($value, Constraint $constraint)
3333
$canonicalize = str_replace(' ', '', $value);
3434

3535
// the bic must be either 8 or 11 characters long
36-
if (!in_array(strlen($canonicalize), array(8, 11))) {
36+
if (!\in_array(\strlen($canonicalize), array(8, 11))) {
3737
$this->context->buildViolation($constraint->message)
3838
->setParameter('{{ value }}', $this->formatValue($value))
3939
->setCode(Bic::INVALID_LENGTH_ERROR)

Constraints/Callback.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ class Callback extends Constraint
3939
public function __construct($options = null)
4040
{
4141
// Invocation through annotations with an array parameter only
42-
if (is_array($options) && 1 === count($options) && isset($options['value'])) {
42+
if (\is_array($options) && 1 === \count($options) && isset($options['value'])) {
4343
$options = $options['value'];
4444
}
4545

46-
if (is_array($options) && isset($options['methods'])) {
46+
if (\is_array($options) && isset($options['methods'])) {
4747
@trigger_error('The "methods" option of the '.__CLASS__.' class is deprecated since Symfony 2.4 and will be removed in 3.0. Use the "callback" option instead.', E_USER_DEPRECATED);
4848
}
4949

50-
if (is_array($options) && !isset($options['callback']) && !isset($options['methods']) && !isset($options['groups']) && !isset($options['payload'])) {
51-
if (is_callable($options) || !$options) {
50+
if (\is_array($options) && !isset($options['callback']) && !isset($options['methods']) && !isset($options['groups']) && !isset($options['payload'])) {
51+
if (\is_callable($options) || !$options) {
5252
$options = array('callback' => $options);
5353
} else {
5454
// @deprecated, to be removed in 3.0

Constraints/CallbackValidator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function validate($object, Constraint $constraint)
4141

4242
// has to be an array so that we can differentiate between callables
4343
// and method names
44-
if (null !== $constraint->methods && !is_array($constraint->methods)) {
44+
if (null !== $constraint->methods && !\is_array($constraint->methods)) {
4545
throw new UnexpectedTypeException($constraint->methods, 'array');
4646
}
4747

@@ -50,18 +50,18 @@ public function validate($object, Constraint $constraint)
5050
foreach ($methods as $method) {
5151
if ($method instanceof \Closure) {
5252
$method($object, $this->context);
53-
} elseif (is_array($method)) {
54-
if (!is_callable($method)) {
55-
if (isset($method[0]) && is_object($method[0])) {
56-
$method[0] = get_class($method[0]);
53+
} elseif (\is_array($method)) {
54+
if (!\is_callable($method)) {
55+
if (isset($method[0]) && \is_object($method[0])) {
56+
$method[0] = \get_class($method[0]);
5757
}
5858
throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable', json_encode($method)));
5959
}
6060

61-
call_user_func($method, $object, $this->context);
61+
\call_user_func($method, $object, $this->context);
6262
} elseif (null !== $object) {
6363
if (!method_exists($object, $method)) {
64-
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, get_class($object)));
64+
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, \get_class($object)));
6565
}
6666

6767
$reflMethod = new \ReflectionMethod($object, $method);

0 commit comments

Comments
 (0)