[PHPDoc] Fix some union type cases

This commit is contained in:
Thomas Calvet 2021-04-07 18:12:22 +02:00
parent e357dbb173
commit dd1481642b
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. * Returns the configuration of the current firewall context.
* *
* @return array|Data * @return array|Data|null
*/ */
public function getFirewall() public function getFirewall()
{ {

View File

@ -123,7 +123,7 @@ class Response
* @param string $header The header name * @param string $header The header name
* @param bool $first Whether to return the first value or all header values * @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) public function getHeader($header, $first = true)
{ {

View File

@ -72,36 +72,26 @@ abstract class Descriptor implements DescriptorInterface
/** /**
* Describes an InputArgument instance. * Describes an InputArgument instance.
*
* @return string|mixed
*/ */
abstract protected function describeInputArgument(InputArgument $argument, array $options = []); abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
/** /**
* Describes an InputOption instance. * Describes an InputOption instance.
*
* @return string|mixed
*/ */
abstract protected function describeInputOption(InputOption $option, array $options = []); abstract protected function describeInputOption(InputOption $option, array $options = []);
/** /**
* Describes an InputDefinition instance. * Describes an InputDefinition instance.
*
* @return string|mixed
*/ */
abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []); abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
/** /**
* Describes a Command instance. * Describes a Command instance.
*
* @return string|mixed
*/ */
abstract protected function describeCommand(Command $command, array $options = []); abstract protected function describeCommand(Command $command, array $options = []);
/** /**
* Describes an Application instance. * Describes an Application instance.
*
* @return string|mixed
*/ */
abstract protected function describeApplication(Application $application, array $options = []); 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 private function getColumnWidth(array $commands): int
{ {

View File

@ -97,7 +97,7 @@ class QuestionHelper extends Helper
/** /**
* Asks the question to the user. * 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 * @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. * 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) private function getValidationGroups(FormInterface $form)
{ {
@ -241,9 +241,9 @@ class FormValidator extends ConstraintValidator
/** /**
* Post-processes the validation groups option for a given form. * 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) private static function resolveValidationGroups($groups, FormInterface $form)
{ {

View File

@ -255,7 +255,7 @@ class HeaderBag implements \IteratorAggregate, \Countable
* *
* @param string $key The directive name * @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) public function getCacheControlDirective($key)
{ {

View File

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

View File

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

View File

@ -26,7 +26,7 @@ final class FormDataPart extends AbstractMultipartPart
private $fields = []; private $fields = [];
/** /**
* @param (string|array|DataPart)[] $fields * @param array<string|array|DataPart> $fields
*/ */
public function __construct(array $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 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 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 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 * @param int|float|null $timeout The timeout in seconds or null to disable
* *
* @throws LogicException When proc_open is not installed * @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 $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 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 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 * @param int|float|null $timeout The timeout in seconds or null to disable
* *
* @return static * @return static

View File

@ -370,7 +370,7 @@ class XmlFileLoader extends FileLoader
/** /**
* Recursively parses the value of a "default" element. * 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 * @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 * and populated in any number of different ways when the user object
* is created. * is created.
* *
* @return (Role|string)[] The user roles * @return array<Role|string> The user roles
*/ */
public function getRoles(); public function getRoles();

View File

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

View File

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

View File

@ -271,9 +271,9 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
/** /**
* Normalizes the given group or list of groups to an array. * 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) protected function normalizeGroups($groups)
{ {

View File

@ -30,9 +30,9 @@ interface ValidatorInterface extends MetadataFactoryInterface
* If no constraint is passed, the constraint * If no constraint is passed, the constraint
* {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
* *
* @param mixed $value The value to validate * @param mixed $value The value to validate
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against * @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 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 * @return ConstraintViolationListInterface A list of constraint violations
* If the list is empty, validation * If the list is empty, validation
@ -44,9 +44,9 @@ interface ValidatorInterface extends MetadataFactoryInterface
* Validates a property of an object against the constraints specified * Validates a property of an object against the constraints specified
* for this property. * for this property.
* *
* @param object $object The object * @param object $object The object
* @param string $propertyName The name of the validated property * @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 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 * @return ConstraintViolationListInterface A list of constraint violations
* If the list is empty, validation * 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 * Validates a value against the constraints specified for an object's
* property. * property.
* *
* @param object|string $objectOrClass The object or its class name * @param object|string $objectOrClass The object or its class name
* @param string $propertyName The name of the property * @param string $propertyName The name of the property
* @param mixed $value The value to validate against the property's constraints * @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 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 * @return ConstraintViolationListInterface A list of constraint violations
* If the list is empty, validation * 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 * - 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 * - 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 * - 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" * 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. * 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. * 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 * @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 * provided, or null when an unsupported type is requested
*/ */
public function getInfo(string $type = null); public function getInfo(string $type = null);
} }