Skip to content

Commit ee5ba53

Browse files
committed
Merge branch '5.0'
* 5.0: Fix CS Fix CS Fix CS
2 parents ff03b69 + 8befd84 commit ee5ba53

File tree

7 files changed

+19
-21
lines changed

7 files changed

+19
-21
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
@@ -73,11 +73,11 @@ public function __construct($options = null)
7373
$constraint = \get_class($constraint);
7474
}
7575

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

7979
if ($constraint instanceof Valid) {
80-
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)));
80+
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));
8181
}
8282
}
8383

@@ -101,7 +101,7 @@ public function __construct($options = null)
101101
$excessGroups = array_diff($constraint->groups, $this->groups);
102102

103103
if (\count($excessGroups) > 0) {
104-
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)));
104+
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));
105105
}
106106
} else {
107107
$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

Tests/Constraints/ExpressionValidatorTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Validator\Tests\Constraints;
1313

1414
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
15-
use Symfony\Component\PropertyAccess\PropertyAccess;
1615
use Symfony\Component\Validator\Constraints\Expression;
1716
use Symfony\Component\Validator\Constraints\ExpressionValidator;
1817
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;

Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Psr\Cache\CacheItemPoolInterface;
1616
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1717
use Symfony\Component\Validator\Constraints\Callback;
18-
use Symfony\Component\Validator\Mapping\Cache\Psr6Cache;
1918
use Symfony\Component\Validator\Mapping\ClassMetadata;
2019
use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory;
2120
use Symfony\Component\Validator\Mapping\Loader\LoaderInterface;

0 commit comments

Comments
 (0)