10000 minor #50831 [7.0] Fix various ``@psalm`-return` annotations (nicolas… · symfony/symfony@b1deb51 · GitHub
[go: up one dir, main page]

Skip to content

Commit b1deb51

Browse files
minor #50831 [7.0] Fix various `@psalm-return` annotations (nicolas-grekas)
This PR was merged into the 7.0 branch. Discussion ---------- [7.0] Fix various ``@psalm`-return` annotations | Q | A | ------------- | --- | Branch? | 7.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- 47e6324 [7.0] Fix various ``@psalm`-return` annotations
2 parents c311883 + 47e6324 commit b1deb51

File tree

6 files changed

+154
-151
lines changed

6 files changed

+154
-151
lines changed

.github/expected-missing-return-types.diff

Lines changed: 144 additions & 129 deletions
Large diffs are not rendered by default.

src/Symfony/Component/DependencyInjection/ParameterBag/ContainerBagInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@ public function all(): array;
3333
*
3434
* @param TValue $value
3535
*
36-
* @return mixed
37-
*
3836
* @psalm-return (TValue is scalar ? array|scalar : array<array|scalar>)
3937
*
4038
* @throws ParameterNotFoundException if a placeholder references a parameter that does not exist
4139
*/
42-
public function resolveValue(mixed $value);
40+
public function resolveValue(mixed $value): mixed;
4341

4442
/**
4543
* Escape parameter placeholders %.

src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,9 @@ public function resolve();
8282
/**
8383
* Replaces parameter placeholders (%name%) by their values.
8484
*
85-
* @return mixed
86-
*
8785
* @throws ParameterNotFoundException if a placeholder references a parameter that does not exist
8886
*/
89-
public function resolveValue(mixed $value);
87+
public function resolveValue(mixed $value): mixed;
9088

9189
/**
9290
* Escape parameter placeholders %.

src/Symfony/Component/Form/DataTransformerInterface.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,11 @@ interface DataTransformerInterface
5858
*
5959
* @param TValue|null $value The value in the original representation
6060
*
61-
* @return mixed
62-
*
63-
* @psalm-return TTransformedValue|null
61+
* @return TTransformedValue|null
6462
*
6563
* @throws TransformationFailedException when the transformation fails
6664
*/
67-
public function transform(mixed $value);
65+
public function transform(mixed $value): mixed;
6866

6967
/**
7068
* Transforms a value from the transformed representation to its original
@@ -89,11 +87,9 @@ public function transform(mixed $value);
8987
*
9088
* @param TTransformedValue|null $value The value in the transformed representation
9189
*
92-
* @return mixed
93-
*
94-
* @psalm-return TValue|null
90+
* @return TValue|null
9591
*
9692
* @throws TransformationFailedException when the transformation fails
9793
*/
98-
public function reverseTransform(mixed $value);
94+
public function reverseTransform(mixed $value): mixed;
9995
}

src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ interface VoterInterface
3333
* @param mixed $subject The subject to secure
3434
* @param array $attributes An array of attributes associated with the method being invoked
3535
*
36-
* @return int either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED
37-
*
38-
* @psalm-return self::ACCESS_* must be transformed into @return on Symfony 7
36+
* @return self::ACCESS_*
3937
*/
40-
public function vote(TokenInterface $token, mixed $subject, array $attributes);
38+
public function vote(TokenInterface $token, mixed $subject, array $attributes): int;
4139
}

src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,9 @@ protected function buildViolation(string|\Stringable $message): ConstraintViolat
286286
}
287287

288288
/**
289-
* @return ConstraintValidatorInterface
290-
*
291-
* @psalm-return T
289+
* @return T
292290
*/
293-
abstract protected function createValidator();
291+
abstract protected function createValidator(): ConstraintValidatorInterface;
294292
}
295293

296294
final class ConstraintViolationAssertion

0 commit comments

Comments
 (0)
0