Skip to content

Commit fb827b0

Browse files
CS fixes
1 parent 837a228 commit fb827b0

File tree

91 files changed

+176
-181
lines changed

Some content is hidden

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

91 files changed

+176
-181
lines changed

Command/DebugCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8080
}
8181
} catch (DirectoryNotFoundException) {
8282
$io = new SymfonyStyle($input, $output);
83-
$io->error(sprintf('Neither class nor path were found with "%s" argument.', $input->getArgument('class')));
83+
$io->error(\sprintf('Neither class nor path were found with "%s" argument.', $input->getArgument('class')));
8484

8585
return 1;
8686
}
@@ -91,7 +91,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9191
private function dumpValidatorsForClass(InputInterface $input, OutputInterface $output, string $class): void
9292
{
9393
$io = new SymfonyStyle($input, $output);
94-
$title = sprintf('<info>%s</info>', $class);
94+
$title = \sprintf('<info>%s</info>', $class);
9595
$rows = [];
9696
$dump = new Dumper($output);
9797

Constraint.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static function getErrorName(string $errorCode): string
8282
}
8383

8484
if (!isset(static::$errorNames[$errorCode])) {
85-
throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, static::class));
85+
throw new InvalidArgumentException(\sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, static::class));
8686
}
8787

8888
trigger_deprecation('symfony/validator', '6.1', 'The "%s::$errorNames" property is deprecated, use protected const ERROR_NAMES instead.', static::class);
@@ -144,7 +144,7 @@ protected function normalizeOptions(mixed $options): array
144144

145145
if (\is_array($options) && isset($options['value']) && !property_exists($this, 'value')) {
146146
if (null === $defaultOption) {
147-
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class));
147+
throw new ConstraintDefinitionException(\sprintf('No default option is configured for constraint "%s".', static::class));
148148
}
149149

150150
$options[$defaultOption] = $options['value'];
@@ -165,7 +165,7 @@ protected function normalizeOptions(mixed $options): array
165165
}
166166
} elseif (null !== $options && !(\is_array($options) && 0 === \count($options))) {
167167
if (null === $defaultOption) {
168-
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class));
168+
throw new ConstraintDefinitionException(\sprintf('No default option is configured for constraint "%s".', static::class));
169169
}
170170

171171
if (\array_key_exists($defaultOption, $knownOptions)) {
@@ -177,11 +177,11 @@ protected function normalizeOptions(mixed $options): array
177177
}
178178

179179
if (\count($invalidOptions) > 0) {
180-
throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint "%s".', implode('", "', $invalidOptions), static::class), $invalidOptions);
180+
throw new InvalidOptionsException(\sprintf('The options "%s" do not exist in constraint "%s".', implode('", "', $invalidOptions), static::class), $invalidOptions);
181181
}
182182

183183
if (\count($missingOptions) > 0) {
184-
throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint "%s".', implode('", "', array_keys($missingOptions)), static::class), array_keys($missingOptions));
184+
throw new MissingOptionsException(\sprintf('The options "%s" must be set for constraint "%s".', implode('", "', array_keys($missingOptions)), static::class), array_keys($missingOptions));
185185
}
186186

187187
return $normalizedOptions;
@@ -206,7 +206,7 @@ public function __set(string $option, mixed $value)
206206
return;
207207
}
208208

209-
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]);
209+
throw new InvalidOptionsException(\sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]);
210210
}
211211

212212
/**
@@ -226,7 +226,7 @@ public function __get(string $option): mixed
226226
return $this->groups;
227227
}
228228

229-
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]);
229+
throw new InvalidOptionsException(\sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]);
230230
}
231231

232232
public function __isset(string $option): bool
@@ -242,7 +242,7 @@ public function __isset(string $option): bool
242242
public function addImplicitGroupName(string $group)
243243
{
244244
if (null === $this->groups && \array_key_exists('groups', (array) $this)) {
245-
throw new \LogicException(sprintf('"%s::$groups" is set to null. Did you forget to call "%s::__construct()"?', static::class, self::class));
245+
throw new \LogicException(\sprintf('"%s::$groups" is set to null. Did you forget to call "%s::__construct()"?', static::class, self::class));
246246
}
247247

248248
if (\in_array(self::DEFAULT_GROUP, $this->groups) && !\in_array($group, $this->groups)) {

ConstraintViolationList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function addAll(ConstraintViolationListInterface $otherList)
7979
public function get(int $offset): ConstraintViolationInterface
8080
{
8181
if (!isset($this->violations[$offset])) {
82-
throw new OutOfBoundsException(sprintf('The offset "%s" does not exist.', $offset));
82+
throw new OutOfBoundsException(\sprintf('The offset "%s" does not exist.', $offset));
8383
}
8484

8585
return $this->violations[$offset];

Constraints/AbstractComparison.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ public function __construct(mixed $value = null, ?string $propertyPath = null, ?
4242
$this->propertyPath = $propertyPath ?? $this->propertyPath;
4343

4444
if (null === $this->value && null === $this->propertyPath) {
45-
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', static::class));
45+
throw new ConstraintDefinitionException(\sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', static::class));
4646
}
4747

4848
if (null !== $this->value && null !== $this->propertyPath) {
49-
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "value" or "propertyPath" options to be set, not both.', static::class));
49+
throw new ConstraintDefinitionException(\sprintf('The "%s" constraint requires only one of the "value" or "propertyPath" options to be set, not both.', static::class));
5050
}
5151

5252
if (null !== $this->propertyPath && !class_exists(PropertyAccess::class)) {
53-
throw new LogicException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option. Try running "composer require symfony/property-access".', static::class));
53+
throw new LogicException(\sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option. Try running "composer require symfony/property-access".', static::class));
5454
}
5555
}
5656

Constraints/AbstractComparisonValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function validate(mixed $value, Constraint $constraint)
5656
try {
5757
$comparedValue = $this->getPropertyAccessor()->getValue($object, $path);
5858
} catch (NoSuchPropertyException $e) {
59-
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: ', $path, get_debug_type($constraint)).$e->getMessage(), 0, $e);
59+
throw new ConstraintDefinitionException(\sprintf('Invalid property path "%s" provided to "%s" constraint: ', $path, get_debug_type($constraint)).$e->getMessage(), 0, $e);
6060
} catch (UninitializedPropertyException) {
6161
$comparedValue = null;
6262
}
@@ -71,7 +71,7 @@ public function validate(mixed $value, Constraint $constraint)
7171
try {
7272
$comparedValue = new $value($comparedValue);
7373
} catch (\Exception) {
74-
throw new ConstraintDefinitionException(sprintf('The compared value "%s" could not be converted to a "%s" instance in the "%s" constraint.', $comparedValue, get_debug_type($value), get_debug_type($constraint)));
74+
throw new ConstraintDefinitionException(\sprintf('The compared value "%s" could not be converted to a "%s" instance in the "%s" constraint.', $comparedValue, get_debug_type($value), get_debug_type($constraint)));
7575
}
7676
}
7777

Constraints/Bic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __construct(?array $options = null, ?string $message = null, ?st
6969
}
7070

7171
if (null !== $this->ibanPropertyPath && !class_exists(PropertyAccess::class)) {
72-
throw new LogicException(sprintf('The "symfony/property-access" component is required to use the "%s" constraint with the "ibanPropertyPath" option. Try running "composer require symfony/property-access".', self::class));
72+
throw new LogicException(\sprintf('The "symfony/property-access" component is required to use the "%s" constraint with the "ibanPropertyPath" option. Try running "composer require symfony/property-access".', self::class));
7373
}
7474
}
7575
}

Constraints/BicValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function validate(mixed $value, Constraint $constraint)
130130
try {
131131
$iban = $this->getPropertyAccessor()->getValue($object, $path);
132132
} catch (NoSuchPropertyException $e) {
133-
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: ', $path, get_debug_type($constraint)).$e->getMessage(), 0, $e);
133+
throw new ConstraintDefinitionException(\sprintf('Invalid property path "%s" provided to "%s" constraint: ', $path, get_debug_type($constraint)).$e->getMessage(), 0, $e);
134134
} catch (UninitializedPropertyException) {
135135
$iban = null;
136136
}

Constraints/CallbackValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function validate(mixed $object, Constraint $constraint)
4646
$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_debug_type($object)));
49+
throw new ConstraintDefinitionException(\sprintf('Method "%s" targeted by Callback constraint does not exist in class "%s".', $method, get_debug_type($object)));
5050
}
5151

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

Constraints/Cascade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(array|string|null $exclude = null, ?array $options =
3535
}
3636

3737
if (\is_array($options) && \array_key_exists('groups', $options)) {
38-
throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint "%s".', __CLASS__));
38+
throw new ConstraintDefinitionException(\sprintf('The option "groups" is not supported by the constraint "%s".', __CLASS__));
3939
}
4040

4141
parent::__construct($options);

Constraints/ChoiceValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public function validate(mixed $value, Constraint $constraint)
5656
throw new ConstraintDefinitionException('The Choice constraint expects a valid callback.');
5757
}
5858
$choices = $choices();
59-
if (!is_array($choices)) {
60-
throw new ConstraintDefinitionException(sprintf('The Choice constraint callback "%s" is expected to return an array, but returned "%s".', trim($this->formatValue($constraint->callback), '"'), get_debug_type($choices)));
59+
if (!\is_array($choices)) {
60+
throw new ConstraintDefinitionException(\sprintf('The Choice constraint callback "%s" is expected to return an array, but returned "%s".', trim($this->formatValue($constraint->callback), '"'), get_debug_type($choices)));
6161
}
6262
} else {
6363
$choices = $constraint->choices;

0 commit comments

Comments
 (0)