Skip to content

Commit 975c11f

Browse files
wouterjnicolas-grekas
authored andcommitted
[Components] Convert to native return types
1 parent b84d8c8 commit 975c11f

File tree

74 files changed

+97
-348
lines changed

Some content is hidden

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

74 files changed

+97
-348
lines changed

Command/DebugCommand.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ public function __construct(MetadataFactoryInterface $validator)
4343
$this->validator = $validator;
4444
}
4545

46-
/**
47-
* @return void
48-
*/
49-
protected function configure()
46+
protected function configure(): void
5047
{
5148
$this
5249
->addArgument('class', InputArgument::REQUIRED, 'A fully qualified class name or a path')

Constraint.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ abstract class Constraint
5151

5252
/**
5353
* Domain-specific data attached to a constraint.
54-
*
55-
* @var mixed
5654
*/
5755
public $payload;
5856

@@ -181,11 +179,9 @@ protected function normalizeOptions(mixed $options): array
181179
* this method will be called at most once per constraint instance and
182180
* option name.
183181
*
184-
* @return void
185-
*
186182
* @throws InvalidOptionsException If an invalid option name is given
187183
*/
188-
public function __set(string $option, mixed $value)
184+
public function __set(string $option, mixed $value): void
189185
{
190186
if ('groups' === $option) {
191187
$this->groups = (array) $value;
@@ -223,10 +219,8 @@ public function __isset(string $option): bool
223219

224220
/**
225221
* Adds the given group if this constraint is in the Default group.
226-
*
227-
* @return void
228222
*/
229-
public function addImplicitGroupName(string $group)
223+
public function addImplicitGroupName(string $group): void
230224
{
231225
if (null === $this->groups && \array_key_exists('groups', (array) $this)) {
232226
throw new \LogicException(sprintf('"%s::$groups" is set to null. Did you forget to call "%s::__construct()"?', static::class, self::class));
@@ -242,11 +236,9 @@ public function addImplicitGroupName(string $group)
242236
*
243237
* Override this method to define a default option.
244238
*
245-
* @return string|null
246-
*
247239
* @see __construct()
248240
*/
249-
public function getDefaultOption()
241+
public function getDefaultOption(): ?string
250242
{
251243
return null;
252244
}
@@ -260,7 +252,7 @@ public function getDefaultOption()
260252
*
261253
* @see __construct()
262254
*/
263-
public function getRequiredOptions()
255+
public function getRequiredOptions(): array
264256
{
265257
return [];
266258
}
@@ -271,10 +263,8 @@ public function getRequiredOptions()
271263
* By default, this is the fully qualified name of the constraint class
272264
* suffixed with "Validator". You can override this method to change that
273265
* behavior.
274-
*
275-
* @return string
276266
*/
277-
public function validatedBy()
267+
public function validatedBy(): string
278268
{
279269
return static::class.'Validator';
280270
}
@@ -288,7 +278,7 @@ public function validatedBy()
288278
*
289279
* @return string|string[] One or more constant values
290280
*/
291-
public function getTargets()
281+
public function getTargets(): string|array
292282
{
293283
return self::PROPERTY_CONSTRAINT;
294284
}

ConstraintValidator.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
3636
*/
3737
protected $context;
3838

39-
/**
40-
* @return void
41-
*/
42-
public function initialize(ExecutionContextInterface $context)
39+
public function initialize(ExecutionContextInterface $context): void
4340
{
4441
$this->context = $context;
4542
}

ConstraintValidatorInterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,11 @@ interface ConstraintValidatorInterface
2020
{
2121
/**
2222
* Initializes the constraint validator.
23-
*
24-
* @return void
2523
*/
26-
public function initialize(ExecutionContextInterface $context);
24+
public function initialize(ExecutionContextInterface $context): void;
2725

2826
/**
2927
* Checks if the passed value is valid.
30-
*
31-
* @return void
3228
*/
33-
public function validate(mixed $value, Constraint $constraint);
29+
public function validate(mixed $value, Constraint $constraint): void;
3430
}

ConstraintViolationList.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,12 @@ public function __toString(): string
5858
return $string;
5959
}
6060

61-
/**
62-
* @return void
63-
*/
64-
public function add(ConstraintViolationInterface $violation)
61+
public function add(ConstraintViolationInterface $violation): void
6562
{
6663
$this->violations[] = $violation;
6764
}
6865

69-
/**
70-
* @return void
71-
*/
72-
public function addAll(ConstraintViolationListInterface $otherList)
66+
public function addAll(ConstraintViolationListInterface $otherList): void
7367
{
7468
foreach ($otherList as $violation) {
7569
$this->violations[] = $violation;
@@ -90,18 +84,12 @@ public function has(int $offset): bool
9084
return isset($this->violations[$offset]);
9185
}
9286

93-
/**
94-
* @return void
95-
*/
96-
public function set(int $offset, ConstraintViolationInterface $violation)
87+
public function set(int $offset, ConstraintViolationInterface $violation): void
9788
{
9889
$this->violations[$offset] = $violation;
9990
}
10091

101-
/**
102-
* @return void
103-
*/
104-
public function remove(int $offset)
92+
public function remove(int $offset): void
10593
{
10694
unset($this->violations[$offset]);
10795
}

ConstraintViolationListInterface.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,13 @@ interface ConstraintViolationListInterface extends \Traversable, \Countable, \Ar
2525
{
2626
/**
2727
* Adds a constraint violation to this list.
28-
*
29-
* @return void
3028
*/
31-
public function add(ConstraintViolationInterface $violation);
29+
public function add(ConstraintViolationInterface $violation): void;
3230

3331
/**
3432
* Merges an existing violation list into this list.
35-
*
36-
* @return void
3733
*/
38-
public function addAll(self $otherList);
34+
public function addAll(self $otherList): void;
3935

4036
/**
4137
* Returns the violation at a given offset.
@@ -57,19 +53,15 @@ public function has(int $offset): bool;
5753
* Sets a violation at a given offset.
5854
*
5955
* @param int $offset The violation offset
60-
*
61-
* @return void
6256
*/
63-
public function set(int $offset, ConstraintViolationInterface $violation);
57+
public function set(int $offset, ConstraintViolationInterface $violation): void;
6458

6559
/**
6660
* Removes a violation at a given offset.
6761
*
6862
* @param int $offset The offset to remove
69-
*
70-
* @return void
7163
*/
72-
public function remove(int $offset);
64+
public function remove(int $offset): void;
7365

7466
/**
7567
* Converts the violation into a string for debugging purposes.

Constraints/AbstractComparisonValidator.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ public function __construct(PropertyAccessorInterface $propertyAccessor = null)
3434
$this->propertyAccessor = $propertyAccessor;
3535
}
3636

37-
/**
38-
* @return void
39-
*/
40-
public function validate(mixed $value, Constraint $constraint)
37+
public function validate(mixed $value, Constraint $constraint): void
4138
{
4239
if (!$constraint instanceof AbstractComparison) {
4340
throw new UnexpectedTypeException($constraint, AbstractComparison::class);

Constraints/AllValidator.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121
*/
2222
class AllValidator extends ConstraintValidator
2323
{
24-
/**
25-
* @return void
26-
*/
27-
public function validate(mixed $value, Constraint $constraint)
24+
public function validate(mixed $value, Constraint $constraint): void
2825
{
2926
if (!$constraint instanceof All) {
3027
throw new UnexpectedTypeException($constraint, All::class);

Constraints/AtLeastOneOfValidator.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
*/
2121
class AtLeastOneOfValidator extends ConstraintValidator
2222
{
23-
/**
24-
* @return void
25-
*/
26-
public function validate(mixed $value, Constraint $constraint)
23+
public function validate(mixed $value, Constraint $constraint): void
2724
{
2825
if (!$constraint instanceof AtLeastOneOf) {
2926
throw new UnexpectedTypeException($constraint, AtLeastOneOf::class);

Constraints/BicValidator.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ public function __construct(PropertyAccessor $propertyAccessor = null)
6363
$this->propertyAccessor = $propertyAccessor;
6464
}
6565

66-
/**
67-
* @return void
68-
*/
69-
public function validate(mixed $value, Constraint $constraint)
66+
public function validate(mixed $value, Constraint $constraint): void
7067
{
7168
if (!$constraint instanceof Bic) {
7269
throw new UnexpectedTypeException($constraint, Bic::class);

0 commit comments

Comments
 (0)