Skip to content

Commit 5ca2475

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 d5f10cd + 1f9588e commit 5ca2475

File tree

72 files changed

+225
-225
lines changed

Some content is hidden

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

72 files changed

+225
-225
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
@@ -58,7 +58,7 @@ public function initialize(ExecutionContextInterface $context)
5858
*/
5959
protected function formatTypeOf($value)
6060
{
61-
return is_object($value) ? get_class($value) : gettype($value);
61+
return \is_object($value) ? \get_class($value) : \gettype($value);
6262
}
6363

6464
/**
@@ -107,23 +107,23 @@ protected function formatValue($value, $format = 0)
107107
return $value->format('Y-m-d H:i:s');
108108
}
109109

110-
if (is_object($value)) {
110+
if (\is_object($value)) {
111111
if (($format & self::OBJECT_TO_STRING) && method_exists($value, '__toString')) {
112112
return $value->__toString();
113113
}
114114

115115
return 'object';
116116
}
117117

118-
if (is_array($value)) {
118+
if (\is_array($value)) {
119119
return 'array';
120120
}
121121

122-
if (is_string($value)) {
122+
if (\is_string($value)) {
123123
return '"'.$value.'"';
124124
}
125125

126-
if (is_resource($value)) {
126+
if (\is_resource($value)) {
127127
return 'resource';
128128
}
129129

ConstraintViolation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ public function __construct(?string $message, ?string $messageTemplate, array $p
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: 2 additions & 2 deletions
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
/**
@@ -171,7 +171,7 @@ public function findByCodes($codes)
171171
$codes = (array) $codes;
172172
$violations = array();
173173
foreach ($this as $violation) {
174-
if (in_array($violation->getCode(), $codes, true)) {
174+
if (\in_array($violation->getCode(), $codes, true)) {
175175
$violations[] = $violation;
176176
}
177177
}

Constraints/AbstractComparison.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ public function __construct($options = null)
3636
$options = array();
3737
}
3838

39-
if (is_array($options)) {
39+
if (\is_array($options)) {
4040
if (!isset($options['value']) && !isset($options['propertyPath'])) {
41-
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', get_class($this)));
41+
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', \get_class($this)));
4242
}
4343

4444
if (isset($options['value']) && isset($options['propertyPath'])) {
45-
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "value" or "propertyPath" options to be set, not both.', get_class($this)));
45+
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "value" or "propertyPath" options to be set, not both.', \get_class($this)));
4646
}
4747

4848
if (isset($options['propertyPath']) && !class_exists(PropertyAccess::class)) {
49-
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option.', get_class($this)));
49+
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option.', \get_class($this)));
5050
}
5151
}
5252

Constraints/AbstractComparisonValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function validate($value, Constraint $constraint)
5555
try {
5656
$comparedValue = $this->getPropertyAccessor()->getValue($object, $path);
5757
} catch (NoSuchPropertyException $e) {
58-
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: %s', $path, get_class($constraint), $e->getMessage()), 0, $e);
58+
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: %s', $path, \get_class($constraint), $e->getMessage()), 0, $e);
5959
}
6060
} else {
6161
$comparedValue = $constraint->value;
@@ -65,7 +65,7 @@ public function validate($value, Constraint $constraint)
6565
// This allows to compare with any date/time value supported by
6666
// the DateTime constructor:
6767
// http://php.net/manual/en/datetime.formats.php
68-
if (is_string($comparedValue)) {
68+
if (\is_string($comparedValue)) {
6969
if ($value instanceof \DateTimeImmutable) {
7070
// If $value is immutable, convert the compared value to a
7171
// DateTimeImmutable too

Constraints/AllValidator.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
return;
3434
}
3535

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

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ class Callback extends Constraint
3232
public function __construct($options = null)
3333
{
3434
// Invocation through annotations with an array parameter only
35-
if (is_array($options) && 1 === count($options) && isset($options['value'])) {
35+
if (\is_array($options) && 1 === \count($options) && isset($options['value'])) {
3636
$options = $options['value'];
3737
}
3838

39-
if (is_array($options) && !isset($options['callback']) && !isset($options['groups']) && !isset($options['payload'])) {
39+
if (\is_array($options) && !isset($options['callback']) && !isset($options['groups']) && !isset($options['payload'])) {
4040
$options = array('callback' => $options);
4141
}
4242

Constraints/CallbackValidator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ public function validate($object, Constraint $constraint)
3535
$method = $constraint->callback;
3636
if ($method instanceof \Closure) {
3737
$method($object, $this->context, $constraint->payload);
38-
} elseif (is_array($method)) {
39-
if (!is_callable($method)) {
40-
if (isset($method[0]) && is_object($method[0])) {
41-
$method[0] = get_class($method[0]);
38+
} elseif (\is_array($method)) {
39+
if (!\is_callable($method)) {
40+
if (isset($method[0]) && \is_object($method[0])) {
41+
$method[0] = \get_class($method[0]);
4242
}
4343
throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable', json_encode($method)));
4444
}
4545

46-
call_user_func($method, $object, $this->context, $constraint->payload);
46+
\call_user_func($method, $object, $this->context, $constraint->payload);
4747
} elseif (null !== $object) {
4848
if (!method_exists($object, $method)) {
49-
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, get_class($object)));
49+
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, \get_class($object)));
5050
}
5151

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

0 commit comments

Comments
 (0)