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 https://github.com/symfony/symfony/issues/40154, I discovered some PHPDoc issues, I'm going to comment in the review. Upper branches will need some fixes too.

Commits
-------

dd1481642b [PHPDoc] Fix some union type cases
This commit is contained in:
Nyholm 2021-04-08 09:40:10 +02:00
commit e2f430dfb4
No known key found for this signature in database
GPG Key ID: D6332DE2B6F8FA38
20 changed files with 45 additions and 55 deletions

View File

@ -389,7 +389,7 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn
/**
* Returns the configuration of the current firewall context.
*
* @return array|Data
* @return array|Data|null
*/
public function getFirewall()
{

View File

@ -123,7 +123,7 @@ class Response
* @param string $header The header name
* @param bool $first Whether to return the first value or all header values
*
* @return string|array The first header value if $first is true, an array of values otherwise
* @return string|array|null The first header value if $first is true, an array of values otherwise
*/
public function getHeader($header, $first = true)
{

View File

@ -72,36 +72,26 @@ abstract class Descriptor implements DescriptorInterface
/**
* Describes an InputArgument instance.
*
* @return string|mixed
*/
abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
/**
* Describes an InputOption instance.
*
* @return string|mixed
*/
abstract protected function describeInputOption(InputOption $option, array $options = []);
/**
* Describes an InputDefinition instance.
*
* @return string|mixed
*/
abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
/**
* Describes a Command instance.
*
* @return string|mixed
*/
abstract protected function describeCommand(Command $command, array $options = []);
/**
* Describes an Application instance.
*
* @return string|mixed
*/
abstract protected function describeApplication(Application $application, array $options = []);
}

View File

@ -298,7 +298,7 @@ class TextDescriptor extends Descriptor
}
/**
* @param (Command|string)[] $commands
* @param array<Command|string> $commands
*/
private function getColumnWidth(array $commands): int
{

View File

@ -97,7 +97,7 @@ class QuestionHelper extends Helper
/**
* Asks the question to the user.
*
* @return bool|mixed|string|null
* @return mixed
*
* @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden
*/

View File

@ -202,7 +202,7 @@ class FormValidator extends ConstraintValidator
/**
* Returns the validation groups of the given form.
*
* @return string|GroupSequence|(string|GroupSequence)[] The validation groups
* @return string|GroupSequence|array<string|GroupSequence> The validation groups
*/
private function getValidationGroups(FormInterface $form)
{
@ -241,9 +241,9 @@ class FormValidator extends ConstraintValidator
/**
* Post-processes the validation groups option for a given form.
*
* @param string|GroupSequence|(string|GroupSequence)[]|callable $groups The validation groups
* @param string|GroupSequence|array<string|GroupSequence>|callable $groups The validation groups
*
* @return GroupSequence|(string|GroupSequence)[] The validation groups
* @return GroupSequence|array<string|GroupSequence> The validation groups
*/
private static function resolveValidationGroups($groups, FormInterface $form)
{

View File

@ -255,7 +255,7 @@ class HeaderBag implements \IteratorAggregate, \Countable
*
* @param string $key The directive name
*
* @return mixed|null The directive value if defined, null otherwise
* @return mixed The directive value if defined, null otherwise
*/
public function getCacheControlDirective($key)
{

View File

@ -27,8 +27,8 @@ class EnvelopeListener implements EventSubscriberInterface
private $recipients;
/**
* @param Address|string $sender
* @param (Address|string)[] $recipients
* @param Address|string $sender
* @param array<Address|string> $recipients
*/
public function __construct($sender = null, array $recipients = null)
{

View File

@ -45,7 +45,7 @@ abstract class AbstractFailedMessagesCommand extends Command
}
/**
* @return mixed|null
* @return mixed
*/
protected function getMessageId(Envelope $envelope)
{

View File

@ -106,7 +106,7 @@ final class Address
}
/**
* @param (Address|string)[] $addresses
* @param array<Address|string> $addresses
*
* @return Address[]
*/

View File

@ -59,7 +59,7 @@ final class Headers
}
/**
* @param (Address|string)[] $addresses
* @param array<Address|string> $addresses
*
* @return $this
*/

View File

@ -26,7 +26,7 @@ final class FormDataPart extends AbstractMultipartPart
private $fields = [];
/**
* @param (string|array|DataPart)[] $fields
* @param array<string|array|DataPart> $fields
*/
public function __construct(array $fields = [])
{

View File

@ -132,7 +132,7 @@ class Process implements \IteratorAggregate
* @param array $command The command to run and its arguments listed as separate entries
* @param string|null $cwd The working directory or null to use the working dir of the current PHP process
* @param array|null $env The environment variables or null to use the same environment as the current PHP process
* @param mixed|null $input The input as stream resource, scalar or \Traversable, or null for no input
* @param mixed $input The input as stream resource, scalar or \Traversable, or null for no input
* @param int|float|null $timeout The timeout in seconds or null to disable
*
* @throws LogicException When proc_open is not installed
@ -183,7 +183,7 @@ class Process implements \IteratorAggregate
* @param string $command The command line to pass to the shell of the OS
* @param string|null $cwd The working directory or null to use the working dir of the current PHP process
* @param array|null $env The environment variables or null to use the same environment as the current PHP process
* @param mixed|null $input The input as stream resource, scalar or \Traversable, or null for no input
* @param mixed $input The input as stream resource, scalar or \Traversable, or null for no input
* @param int|float|null $timeout The timeout in seconds or null to disable
*
* @return static

View File

@ -370,7 +370,7 @@ class XmlFileLoader extends FileLoader
/**
* Recursively parses the value of a "default" element.
*
* @return array|bool|float|int|string The parsed value
* @return array|bool|float|int|string|null The parsed value
*
* @throws \InvalidArgumentException when the XML is invalid
*/

View File

@ -44,7 +44,7 @@ interface UserInterface
* and populated in any number of different ways when the user object
* is created.
*
* @return (Role|string)[] The user roles
* @return array<Role|string> The user roles
*/
public function getRoles();

View File

@ -66,8 +66,8 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
private $normalizerCache = [];
/**
* @param (NormalizerInterface|DenormalizerInterface)[] $normalizers
* @param (EncoderInterface|DecoderInterface)[] $encoders
* @param array<NormalizerInterface|DenormalizerInterface> $normalizers
* @param array<EncoderInterface|DecoderInterface> $encoders
*/
public function __construct(array $normalizers = [], array $encoders = [])
{

View File

@ -40,9 +40,9 @@ interface ContextualValidatorInterface
* If no constraint is passed, the constraint
* {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
*
* @param mixed $value The value to validate
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
* @param mixed $value The value to validate
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
*
* @return $this
*/
@ -52,9 +52,9 @@ interface ContextualValidatorInterface
* Validates a property of an object against the constraints specified
* for this property.
*
* @param object $object The object
* @param string $propertyName The name of the validated property
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
* @param object $object The object
* @param string $propertyName The name of the validated property
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
*
* @return $this
*/
@ -64,10 +64,10 @@ interface ContextualValidatorInterface
* Validates a value against the constraints specified for an object's
* property.
*
* @param object|string $objectOrClass The object or its class name
* @param string $propertyName The name of the property
* @param mixed $value The value to validate against the property's constraints
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
* @param object|string $objectOrClass The object or its class name
* @param string $propertyName The name of the property
* @param mixed $value The value to validate against the property's constraints
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
*
* @return $this
*/

View File

@ -271,9 +271,9 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
/**
* Normalizes the given group or list of groups to an array.
*
* @param string|GroupSequence|(string|GroupSequence)[] $groups The groups to normalize
* @param string|GroupSequence|array<string|GroupSequence> $groups The groups to normalize
*
* @return (string|GroupSequence)[] A group array
* @return array<string|GroupSequence> A group array
*/
protected function normalizeGroups($groups)
{

View File

@ -30,9 +30,9 @@ interface ValidatorInterface extends MetadataFactoryInterface
* If no constraint is passed, the constraint
* {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
*
* @param mixed $value The value to validate
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
* @param mixed $value The value to validate
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
*
* @return ConstraintViolationListInterface A list of constraint violations
* If the list is empty, validation
@ -44,9 +44,9 @@ interface ValidatorInterface extends MetadataFactoryInterface
* Validates a property of an object against the constraints specified
* for this property.
*
* @param object $object The object
* @param string $propertyName The name of the validated property
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
* @param object $object The object
* @param string $propertyName The name of the validated property
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
*
* @return ConstraintViolationListInterface A list of constraint violations
* If the list is empty, validation
@ -58,10 +58,10 @@ interface ValidatorInterface extends MetadataFactoryInterface
* Validates a value against the constraints specified for an object's
* property.
*
* @param object|string $objectOrClass The object or its class name
* @param string $propertyName The name of the property
* @param mixed $value The value to validate against the property's constraints
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
* @param object|string $objectOrClass The object or its class name
* @param string $propertyName The name of the property
* @param mixed $value The value to validate against the property's constraints
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
*
* @return ConstraintViolationListInterface A list of constraint violations
* If the list is empty, validation

View File

@ -97,15 +97,15 @@ interface ResponseInterface
* - response_headers (array) - an array modelled after the special $http_response_header variable
* - start_time (float) - the time when the request was sent or 0.0 when it's pending
* - url (string) - the last effective URL of the request
* - user_data (mixed|null) - the value of the "user_data" request option, null if not set
* - user_data (mixed) - the value of the "user_data" request option, null if not set
*
* When the "capture_peer_cert_chain" option is true, the "peer_certificate_chain"
* attribute SHOULD list the peer certificates as an array of OpenSSL X.509 resources.
*
* Other info SHOULD be named after curl_getinfo()'s associative return value.
*
* @return array|mixed|null An array of all available info, or one of them when $type is
* provided, or null when an unsupported type is requested
* @return array|mixed An array of all available info, or one of them when $type is
* provided, or null when an unsupported type is requested
*/
public function getInfo(string $type = null);
}