8000 minor #40728 [PHPDoc] Fix some union type cases (fancyweb) · symfony/symfony@e2f430d · GitHub
[go: up one dir, main page]

Skip to content

Commit e2f430d

Browse files
committed
minor #40728 [PHPDoc] Fix some union type cases (fancyweb)
This PR was merged into the 4.4 branch. Discussion ---------- [PHPDoc] Fix some union type cases | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - While working on #40154, I discovered some PHPDoc issues, I'm going to comment in the review. Upper branches will need some fixes too. Commits ------- dd14816 [PHPDoc] Fix some union type cases
2 parents b946077 + dd14816 commit e2f430d

File tree

20 files changed

+45
-55
lines changed

20 files changed

+45
-55
lines changed

src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ public function getAccessDecisionLog()
389389
/**
390390
* Returns the configuration of the current firewall context.
391391
*
392-
* @return array|Data
392+
* @return array|Data|null
393393
*/
394394
public function getFirewall()
395395
{

src/Symfony/Component/BrowserKit/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function getHeaders()
123123
* @param string $header The header name
124124
* @param bool $first Whether to return the first value or all header values
125125
*
126-
* @return string|array The first header value if $first is true, an array of values otherwise
126+
* @return string|array|null The first header value if $first is true, an array of values otherwise
127127
*/
128128
public function getHeader($header, $first = true)
129129
{

src/Symfony/Component/Console/Descriptor/Descriptor.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,36 +72,26 @@ protected function write($content, $decorated = false)
7272

7373
/**
7474
* Describes an InputArgument instance.
75-
*
76-
* @return string|mixed
7775
*/
7876
abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
7977

8078
/**
8179
* Describes an InputOption instance.
82-
*
83-
* @return string|mixed
8480
*/
8581
abstract protected function describeInputOption(InputOption $option, array $options = []);
8682

8783
/**
8884
* Describes an InputDefinition instance.
89-
*
90-
* @return string|mixed
9185
*/
9286
abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
9387

9488
/**
9589
* Describes a Command instance.
96-
*
97-
* @return string|mixed
9890
*/
9991
abstract protected function describeCommand(Command $command, array $options = []);
10092

10193
/**
10294
* Describes an Application instance.
103-
*
104-
* @return string|mixed
10595
*/
10696
abstract protected function describeApplication(Application $application, array $options = []);
10797
}

src/Symfony/Component/Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ private function formatDefaultValue($default): string
298298
}
299299

300300
/**
301-
* @param (Command|string)[] $commands
301+
* @param array<Command|string> $commands
302302
*/
303303
private function getColumnWidth(array $commands): int
304304
{

src/Symfony/Component/Console/Helper/QuestionHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public static function disableStty()
9797
/**
9898
* Asks the question to the user.
9999
*
100-
* @return bool|mixed|string|null
100+
* @return mixed
101101
*
102102
* @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden
103103
*/

src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function validate($form, Constraint $formConstraint)
202202
/**
203203
* Returns the validation groups of the given form.
204204
*
205-
* @return string|GroupSequence|(string|GroupSequence)[] The validation groups
205+
* @return string|GroupSequence|array<string|GroupSequence> The validation groups
206206
*/
207207
private function getValidationGroups(FormInterface $form)
208208
{
@@ -241,9 +241,9 @@ private function getValidationGroups(FormInterface $form)
241241
/**
242242
* Post-processes the validation groups option for a given form.
243243
*
244-
* @param string|GroupSequence|(string|GroupSequence)[]|callable $groups The validation groups
244+
* @param string|GroupSequence|array<string|GroupSequence>|callable $groups The validation groups
245245
*
246-
* @return GroupSequence|(string|GroupSequence)[] The validation group 10BC0 s
246+
* @return GroupSequence|array<string|GroupSequence> The validation groups
247247
*/
248248
private static function resolveValidationGroups($groups, FormInterface $form)
249249
{

src/Symfony/Component/HttpFoundation/HeaderBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public function hasCacheControlDirective($key)
255255
*
256256
* @param string $key The directive name
257257
*
258-
* @return mixed|null The directive value if defined, null otherwise
258+
* @return mixed The directive value if defined, null otherwise
259259
*/
260260
public function getCacheControlDirective($key)
261261
{

src/Symfony/Component/Mailer/EventListener/EnvelopeListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class EnvelopeListener implements EventSubscriberInterface
2727
private $recipients;
2828

2929
/**
30-
* @param Address|string $sender
31-
* @param (Address|string)[] $recipients
30+
* @param Address|string $sender
31+
* @param array<Address|string> $recipients
3232
*/
3333
public function __construct($sender = null, array $recipients = null)
3434
{

src/Symfony/Component/Messenger/Command/AbstractFailedMessagesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function getReceiverName(): string
4545
}
4646

4747
/**
48-
* @return mixed|null
48+
* @return mixed
4949
*/
5050
protected function getMessageId(Envelope $envelope)
5151
{

src/Symfony/Component/Mime/Address.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public static function create($address): self
106106
}
107107

108108
/**
109-
* @param (Address|string)[] $addresses
109+
* @param array<Address|string> $addresses
110110
*
111111
* @return Address[]
112112
*/

src/Symfony/Component/Mime/Header/Headers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getMaxLineLength(): int
5959
}
6060

6161
/**
62-
* @param (Address|string)[] $addresses
62+
* @param array<Address|string> $addresses
6363
*
6464
* @return $this
6565
*/

src/Symfony/Component/Mime/Part/Multipart/FormDataPart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class FormDataPart extends AbstractMultipartPart
2626
private $fields = [];
2727

2828
/**
29-
* @param (string|array|DataPart)[] $fields
29+
* @param array<string|array|DataPart> $fields
3030
*/
3131
public function __construct(array $fields = [])
3232
{

src/Symfony/Component/Process/Process.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class Process implements \IteratorAggregate
132132
* @param array $command The command to run and its arguments listed as separate entries
133133
* @param string|null $cwd The working directory or null to use the working dir of the current PHP process
134134
* @param array|null $env The environment variables or null to use the same environment as the current PHP process
135-
* @param mixed|null $input The input as stream resource, scalar or \Traversable, or null for no input
135+
* @param mixed $input The input as stream resource, scalar or \Traversable, or null for no input
136136
* @param int|float|null $timeout The timeout in seconds or null to disable
137137
*
138138
* @throws LogicException When proc_open is not installed
@@ -183,7 +183,7 @@ public function __construct($command, string $cwd = null, array $env = null, $in
183183
* @param string $command The command line to pass to the shell of the OS
184184
* @param string|null $cwd The working directory or null to use the working dir of the current PHP process
185185
* @param array|null $env The environment variables or null to use the same environment as the current PHP process
186-
* @param mixed|null $input The input as stream resource, scalar or \Traversable, or null for no input
186+
* @param mixed $input The input as stream resource, scalar or \Traversable, or null for no input
187187
* @param int|float|null $timeout The timeout in seconds or null to disable
188188
*
189189
* @return static

src/Symfony/Component/Routing/Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ private function parseDefaultsConfig(\DOMElement $element, string $path)
370370
/**
371371
* Recursively parses the value of a "default" element.
372372
*
373-
* @return array|bool|float|int|string The parsed value
373+
* @return array|bool|float|int|string|null The parsed value
374374
*
375375
* @throws \InvalidArgumentException when the XML is invalid
376376
*/

src/Symfony/Component/Security/Core/User/UserInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ interface UserInterface
4444
* and populated in any number of different ways when the user object
4545
* is created.
4646
*
47-
* @return (Role|string)[] The user roles
47+
* @return array<Role|string> The user roles
4848
*/
4949
public function getRoles();
5050

src/Symfony/Component/Serializer/Serializer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
6666
private $normalizerCache = [];
6767

6868
/**
69-
* @param (NormalizerInterface|DenormalizerInterface)[] $normalizers
70-
* @param (EncoderInterface|DecoderInterface)[] $encoders
69+
* @param array<NormalizerInterface|DenormalizerInterface> $normalizers
70+
* @param array<EncoderInterface|DecoderInterface> $encoders
7171
*/
7272
public function __construct(array $normalizers = [], array $encoders = [])
7373
{

src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public function atPath($path);
4040
* If no constraint is passed, the constraint
4141
* {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
4242
*
43-
* @param mixed $value The value to validate
44-
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
45-
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
43+
* @param mixed $value The value to validate
44+
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
45+
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
4646
*
4747
* @return $this
4848
*/
@@ -52,9 +52,9 @@ public function validate($value, $constraints = null, $groups = null);
5252
* Validates a property of an object against the constraints specified
5353
* for this property.
5454
*
55-
* @param object $object The object
56-
* @param string $propertyName The name of the validated property
57-
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
55+
* @param object $object The object
56+
* @param string $propertyName The name of the validated property
57+
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
5858
*
5959
* @return $this
6060
*/
@@ -64,10 +64,10 @@ public function validateProperty($object, $propertyName, $groups = null);
6464
* Validates a value against the constraints specified for an object's
6565
* property.
6666
*
67-
* @param object|string $objectOrClass The object or its class name
68-
* @param string $propertyName The name of the property
69-
* @param mixed $value The value to validate against the property's constraints
70-
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
67+
* @param object|string $objectOrClass The object or its class name
68+
* @param string $propertyName The name of the property
69+
* @param mixed $value The value to validate against the property's constraints
70+
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
7171
*
7272
* @return $this
7373
*/

src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ public function getViolations()
271271
/**
272272
* Normalizes the given group or list of groups to an array.
273273
*
274-
* @param string|GroupSequence|(string|GroupSequence)[] $groups The groups to normalize
274+
* @param string|GroupSequence|array<string|GroupSequence> $groups The groups to normalize
275275
*
276-
* @return (string|GroupSequence)[] A group array
276+
* @return array<string|GroupSequence> A group array
277277
*/
278278
protected function normalizeGroups($groups)
279279
{

src/Symfony/Component/Validator/Validator/ValidatorInterface.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ interface ValidatorInterface extends MetadataFactoryInterface
3030
* If no constraint is passed, the constraint
3131
* {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
3232
*
33-
* @param mixed $value The value to validate
34-
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
35-
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
33+
* @param mixed $value The value to validate
34+
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
35+
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
3636
*
3737
* @return ConstraintViolationListInterface A list of constraint violations
3838
* If the list is empty, validation
@@ -44,9 +44,9 @@ public function validate($value, $constraints = null, $groups = null);
4444
* Validates a property of an object against the constraints specified
4545
* for this property.
4646
*
47-
* @param object $object The object
48-
* @param string $propertyName The name of the validated property
49-
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
47+
* @param object $object The object
48+
* @param string $propertyName The name of the validated property
49+
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
5050
*
5151
* @return ConstraintViolationListInterface A list of constraint violations
5252
* If the list is empty, validation
@@ -58,10 +58,10 @@ public function validateProperty($object, $propertyName, $groups = null);
5858
* Validates a value against the constraints specified for an object's
5959
* property.
6060
*
61-
* @param object|string $objectOrClass The object or its class name
62-
* @param string $propertyName The name of the property
63-
* @param mixed $value The value to validate against the property's constraints
64-
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
61+
* @param object|string $objectOrClass The object or its class name
62+
* @param string $propertyName The name of the property
63+
* @param mixed $value The value to validate against the property's constraints
64+
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
6565
*
6666
* @return ConstraintViolationListInterface A list of constraint violations
6767
* If the list is empty, validation

src/Symfony/Contracts/HttpClient/ResponseInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ public function cancel(): void;
9797
* - response_headers (array) - an array modelled after the special $http_response_header variable
9898
* - start_time (float) - the time when the request was sent or 0.0 when it's pending
9999
* - url (string) - the last effective URL of the request
100-
* - user_data (mixed|null) - the value of the "user_data" request option, null if not set
100+
* - user_data (mixed) - the value of the "user_data" request option, null if not set
101101
*
102102
* When the "capture_peer_cert_chain" option is true, the "peer_certificate_chain"
103103
* attribute SHOULD list the peer certificates as an array of OpenSSL X.509 resources.
104104
*
105105
* Other info SHOULD be named after curl_getinfo()'s associative return value.
106106
*
107-
* @return array|mixed|null An array of all available info, or one of them when $type is
108-
* provided, or null when an unsupported type is requested
107+
* @return array|mixed An array of all available info, or one of them when $type is
108+
* provided, or null when an unsupported type is requested
109109
*/
110110
public function getInfo(string $type = null);
111111
}

0 commit comments

Comments
 (0)
0