Skip to content

Commit 66c7028

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: Fix CS Fix CS
2 parents 2898c2d + ae7a6e3 commit 66c7028

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

Constraint.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ abstract class Constraint
7070
public static function getErrorName($errorCode)
7171
{
7272
if (!isset(static::$errorNames[$errorCode])) {
73-
throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, \get_called_class()));
73+
throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, static::class));
7474
}
7575

7676
return static::$errorNames[$errorCode];
@@ -115,7 +115,7 @@ public function __construct($options = null)
115115

116116
if (\is_array($options) && isset($options['value']) && !property_exists($this, 'value')) {
117117
if (null === $defaultOption) {
118-
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', \get_class($this)));
118+
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class));
119119
}
120120

121121
$options[$defaultOption] = $options['value'];
@@ -136,7 +136,7 @@ public function __construct($options = null)
136136
}
137137
} elseif (null !== $options && !(\is_array($options) && 0 === \count($options))) {
138138
if (null === $defaultOption) {
139-
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', \get_class($this)));
139+
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class));
140140
}
141141

142142
if (\array_key_exists($defaultOption, $knownOptions)) {
@@ -148,11 +148,11 @@ public function __construct($options = null)
148148
}
149149

150150
if (\count($invalidOptions) > 0) {
151-
throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint "%s".', implode('", "', $invalidOptions), \get_class($this)), $invalidOptions);
151+
throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint "%s".', implode('", "', $invalidOptions), static::class), $invalidOptions);
152152
}
153153

154154
if (\count($missingOptions) > 0) {
155-
throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint "%s".', implode('", "', array_keys($missingOptions)), \get_class($this)), array_keys($missingOptions));
155+
throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint "%s".', implode('", "', array_keys($missingOptions)), static::class), array_keys($missingOptions));
156156
}
157157
}
158158

@@ -175,7 +175,7 @@ public function __set(string $option, $value)
175175
return;
176176
}
177177

178-
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, \get_class($this)), [$option]);
178+
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]);
179179
}
180180

181181
/**
@@ -201,7 +201,7 @@ public function __get(string $option)
201201
return $this->groups;
202202
}
203203

204-
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, \get_class($this)), [$option]);
204+
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]);
205205
}
206206

207207
/**
@@ -265,7 +265,7 @@ public function getRequiredOptions()
265265
*/
266266
public function validatedBy()
267267
{
268-
return \get_class($this).'Validator';
268+
return static::class.'Validator';
269269
}
270270

271271
/**

Constraints/AbstractComparison.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ public function __construct($options = null)
3939

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

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

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

Constraints/Composite.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ public function __construct($options = null)
7171
$constraint = \get_class($constraint);
7272
}
7373

74-
throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s', $constraint, \get_class($this)));
74+
throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s', $constraint, static::class));
7575
}
7676

7777
if ($constraint instanceof Valid) {
78-
throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint %s. You can only declare the Valid constraint directly on a field or method.', \get_class($this)));
78+
throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint %s. You can only declare the Valid constraint directly on a field or method.', static::class));
7979
}
8080
}
8181

@@ -99,7 +99,7 @@ public function __construct($options = null)
9999
$excessGroups = array_diff($constraint->groups, $this->groups);
100100

101101
if (\count($excessGroups) > 0) {
102-
throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s', implode('", "', $excessGroups), \get_class($constraint), \get_class($this)));
102+
throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s', implode('", "', $excessGroups), \get_class($constraint), static::class));
103103
}
104104
} else {
105105
$constraint->groups = $this->groups;

Constraints/NumberConstraintTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ private function configureNumberConstraintOptions($options): array
2727
}
2828

2929
if (isset($options['propertyPath'])) {
30-
throw new ConstraintDefinitionException(sprintf('The "propertyPath" option of the "%s" constraint cannot be set.', \get_class($this)));
30+
throw new ConstraintDefinitionException(sprintf('The "propertyPath" option of the "%s" constraint cannot be set.', static::class));
3131
}
3232

3333
if (isset($options['value'])) {
34-
throw new ConstraintDefinitionException(sprintf('The "value" option of the "%s" constraint cannot be set.', \get_class($this)));
34+
throw new ConstraintDefinitionException(sprintf('The "value" option of the "%s" constraint cannot be set.', static::class));
3535
}
3636

3737
$options['value'] = 0;

Constraints/Range.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ public function __construct($options = null)
5050
{
5151
if (\is_array($options)) {
5252
if (isset($options['min']) && isset($options['minPropertyPath'])) {
53-
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "min" or "minPropertyPath" options to be set, not both.', \get_class($this)));
53+
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "min" or "minPropertyPath" options to be set, not both.', static::class));
5454
}
5555

5656
if (isset($options['max']) && isset($options['maxPropertyPath'])) {
57-
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "max" or "maxPropertyPath" options to be set, not both.', \get_class($this)));
57+
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "max" or "maxPropertyPath" options to be set, not both.', static::class));
5858
}
5959

6060
if ((isset($options['minPropertyPath']) || isset($options['maxPropertyPath'])) && !class_exists(PropertyAccess::class)) {
61-
throw new LogicException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "minPropertyPath" or "maxPropertyPath" option.', \get_class($this)));
61+
throw new LogicException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "minPropertyPath" or "maxPropertyPath" option.', static::class));
6262
}
6363
}
6464

0 commit comments

Comments
 (0)