Skip to content

Commit

Permalink
minor #28675 [CS] Enforces null type hint on last position in phpDocs…
Browse files Browse the repository at this point in the history
… (carusogabriel)

This PR was merged into the 2.8 branch.

Discussion
----------

[CS] Enforces null type hint on last position in phpDocs

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | -   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | - <!-- required for new features -->

As a majority in our codebase, the `null` typehint usually comes in the last position in phpDocs.

Commits
-------

efbba25 [CS] Enforces null type hint on last position in phpDocs
  • Loading branch information
nicolas-grekas committed Oct 2, 2018
2 parents 73d74c4 + efbba25 commit 47f2aee
Show file tree
Hide file tree
Showing 50 changed files with 86 additions and 86 deletions.
Expand Up @@ -453,7 +453,7 @@ abstract protected function getMappingResourceExtension();
/** /**
* Search for a manager that is declared as 'auto_mapping' = true. * Search for a manager that is declared as 'auto_mapping' = true.
* *
* @return null|string The name of the manager. If no one manager is found, returns null * @return string|null The name of the manager. If no one manager is found, returns null
* *
* @throws \LogicException * @throws \LogicException
*/ */
Expand Down
Expand Up @@ -45,7 +45,7 @@ class DoctrineChoiceLoader implements ChoiceLoaderInterface
* @param ObjectManager $manager The object manager * @param ObjectManager $manager The object manager
* @param string $class The class name of the loaded objects * @param string $class The class name of the loaded objects
* @param IdReader $idReader The reader for the object IDs * @param IdReader $idReader The reader for the object IDs
* @param null|EntityLoaderInterface $objectLoader The objects loader * @param EntityLoaderInterface|null $objectLoader The objects loader
*/ */
public function __construct(ChoiceListFactoryInterface $factory, ObjectManager $manager, $class, IdReader $idReader = null, EntityLoaderInterface $objectLoader = null) public function __construct(ChoiceListFactoryInterface $factory, ObjectManager $manager, $class, IdReader $idReader = null, EntityLoaderInterface $objectLoader = null)
{ {
Expand Down
Expand Up @@ -89,7 +89,7 @@ public static function parse($str)
* Parses escape sequences in strings (all string types apart from single quoted). * Parses escape sequences in strings (all string types apart from single quoted).
* *
* @param string $str String without quotes * @param string $str String without quotes
* @param null|string $quote Quote type * @param string|null $quote Quote type
* *
* @return string String with escape sequences parsed * @return string String with escape sequences parsed
*/ */
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Command/Command.php
Expand Up @@ -140,7 +140,7 @@ protected function configure()
* execute() method, you set the code to execute by passing * execute() method, you set the code to execute by passing
* a Closure to the setCode() method. * a Closure to the setCode() method.
* *
* @return null|int null or 0 if everything went fine, or an error code * @return int|null null or 0 if everything went fine, or an error code
* *
* @throws LogicException When this abstract method is not implemented * @throws LogicException When this abstract method is not implemented
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Helper/QuestionHelper.php
Expand Up @@ -109,7 +109,7 @@ public function getName()
* *
* This method is public for PHP 5.3 compatibility, it should be private. * This method is public for PHP 5.3 compatibility, it should be private.
* *
* @return bool|mixed|null|string * @return bool|mixed|string|null
* *
* @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
*/ */
Expand Down
12 changes: 6 additions & 6 deletions src/Symfony/Component/Console/Question/Question.php
Expand Up @@ -117,7 +117,7 @@ public function setHiddenFallback($fallback)
/** /**
* Gets values for the autocompleter. * Gets values for the autocompleter.
* *
* @return null|iterable * @return iterable|null
*/ */
public function getAutocompleterValues() public function getAutocompleterValues()
{ {
Expand All @@ -127,7 +127,7 @@ public function getAutocompleterValues()
/** /**
* Sets values for the autocompleter. * Sets values for the autocompleter.
* *
* @param null|iterable $values * @param iterable|null $values
* *
* @return $this * @return $this
* *
Expand Down Expand Up @@ -156,7 +156,7 @@ public function setAutocompleterValues($values)
/** /**
* Sets a validator for the question. * Sets a validator for the question.
* *
* @param null|callable $validator * @param callable|null $validator
* *
* @return $this * @return $this
*/ */
Expand All @@ -170,7 +170,7 @@ public function setValidator($validator)
/** /**
* Gets the validator for the question. * Gets the validator for the question.
* *
* @return null|callable * @return callable|null
*/ */
public function getValidator() public function getValidator()
{ {
Expand All @@ -182,7 +182,7 @@ public function getValidator()
* *
* Null means an unlimited number of attempts. * Null means an unlimited number of attempts.
* *
* @param null|int $attempts * @param int|null $attempts
* *
* @return $this * @return $this
* *
Expand All @@ -204,7 +204,7 @@ public function setMaxAttempts($attempts)
* *
* Null means an unlimited number of attempts. * Null means an unlimited number of attempts.
* *
* @return null|int * @return int|null
*/ */
public function getMaxAttempts() public function getMaxAttempts()
{ {
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/CssSelector/Node/ElementNode.php
Expand Up @@ -37,15 +37,15 @@ public function __construct($namespace = null, $element = null)
} }


/** /**
* @return null|string * @return string|null
*/ */
public function getNamespace() public function getNamespace()
{ {
return $this->namespace; return $this->namespace;
} }


/** /**
* @return null|string * @return string|null
*/ */
public function getElement() public function getElement()
{ {
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/CssSelector/Node/SelectorNode.php
Expand Up @@ -28,7 +28,7 @@ class SelectorNode extends AbstractNode


/** /**
* @param NodeInterface $tree * @param NodeInterface $tree
* @param null|string $pseudoElement * @param string|null $pseudoElement
*/ */
public function __construct(NodeInterface $tree, $pseudoElement = null) public function __construct(NodeInterface $tree, $pseudoElement = null)
{ {
Expand All @@ -45,7 +45,7 @@ public function getTree()
} }


/** /**
* @return null|string * @return string|null
*/ */
public function getPseudoElement() public function getPseudoElement()
{ {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/CssSelector/Parser/TokenStream.php
Expand Up @@ -142,7 +142,7 @@ public function getNextIdentifier()
/** /**
* Returns nex identifier or star delimiter token. * Returns nex identifier or star delimiter token.
* *
* @return null|string The identifier token value or null if star found * @return string|null The identifier token value or null if star found
* *
* @throws SyntaxErrorException If next token is not an identifier or a star delimiter * @throws SyntaxErrorException If next token is not an identifier or a star delimiter
*/ */
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Debug/ErrorHandler.php
Expand Up @@ -115,7 +115,7 @@ class ErrorHandler
/** /**
* Registers the error handler. * Registers the error handler.
* *
* @param self|null|int $handler The handler to register, or @deprecated (since version 2.6, to be removed in 3.0) bit field of thrown levels * @param self|int|null $handler The handler to register, or @deprecated (since version 2.6, to be removed in 3.0) bit field of thrown levels
* @param bool $replace Whether to replace or not any existing handler * @param bool $replace Whether to replace or not any existing handler
* *
* @return self The registered error handler * @return self The registered error handler
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/DependencyInjection/Definition.php
Expand Up @@ -142,8 +142,8 @@ public function setFactoryMethod($factoryMethod)
/** /**
* Sets the service that this service is decorating. * Sets the service that this service is decorating.
* *
* @param null|string $id The decorated service id, use null to remove decoration * @param string|null $id The decorated service id, use null to remove decoration
* @param null|string $renamedId The new decorated service id * @param string|null $renamedId The new decorated service id
* @param int $priority The priority of decoration * @param int $priority The priority of decoration
* *
* @return $this * @return $this
Expand All @@ -168,7 +168,7 @@ public function setDecoratedService($id, $renamedId = null, $priority = 0)
/** /**
* Gets the service that this service is decorating. * Gets the service that this service is decorating.
* *
* @return null|array An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated * @return array|null An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated
*/ */
public function getDecoratedService() public function getDecoratedService()
{ {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/DomCrawler/Crawler.php
Expand Up @@ -104,7 +104,7 @@ public function add($node)
* HTTP 1.1 specification. * HTTP 1.1 specification.
* *
* @param string $content A string to parse as HTML/XML * @param string $content A string to parse as HTML/XML
* @param null|string $type The content type of the string * @param string|null $type The content type of the string
*/ */
public function addContent($content, $type = null) public function addContent($content, $type = null)
{ {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Filesystem/Filesystem.php
Expand Up @@ -578,7 +578,7 @@ public function tempnam($dir, $prefix)
* *
* @param string $filename The file to be written to * @param string $filename The file to be written to
* @param string $content The data to write into the file * @param string $content The data to write into the file
* @param null|int $mode The file mode (octal). If null, file permissions are not modified * @param int|null $mode The file mode (octal). If null, file permissions are not modified
* Deprecated since version 2.3.12, to be removed in 3.0. * Deprecated since version 2.3.12, to be removed in 3.0.
* *
* @throws IOException if the file cannot be written to * @throws IOException if the file cannot be written to
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/Button.php
Expand Up @@ -368,7 +368,7 @@ public function handleRequest($request = null)
/** /**
* Submits data to the button. * Submits data to the button.
* *
* @param null|string $submittedData The data * @param string|null $submittedData The data
* @param bool $clearMissing Not used * @param bool $clearMissing Not used
* *
* @return $this * @return $this
Expand Down
Expand Up @@ -32,7 +32,7 @@ interface ChoiceListFactoryInterface
* argument. * argument.
* *
* @param iterable $choices The choices * @param iterable $choices The choices
* @param null|callable $value The callable generating the choice * @param callable|null $value The callable generating the choice
* values * values
* *
* @return ChoiceListInterface The choice list * @return ChoiceListInterface The choice list
Expand All @@ -51,7 +51,7 @@ public function createListFromChoices($choices, $value = null);
* argument. * argument.
* *
* @param array|\Traversable $choices The choices * @param array|\Traversable $choices The choices
* @param null|callable $value The callable generating the choice * @param callable|null $value The callable generating the choice
* values * values
* *
* @return ChoiceListInterface The choice list * @return ChoiceListInterface The choice list
Expand All @@ -69,7 +69,7 @@ public function createListFromFlippedChoices($choices, $value = null);
* argument. * argument.
* *
* @param ChoiceLoaderInterface $loader The choice loader * @param ChoiceLoaderInterface $loader The choice loader
* @param null|callable $value The callable generating the choice * @param callable|null $value The callable generating the choice
* values * values
* *
* @return ChoiceListInterface The choice list * @return ChoiceListInterface The choice list
Expand Down Expand Up @@ -103,14 +103,14 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
* attributes that should be added to the respective choice. * attributes that should be added to the respective choice.
* *
* @param ChoiceListInterface $list The choice list * @param ChoiceListInterface $list The choice list
* @param null|array|callable $preferredChoices The preferred choices * @param array|callable|null $preferredChoices The preferred choices
* @param null|callable $label The callable generating the * @param callable|null $label The callable generating the
* choice labels * choice labels
* @param null|callable $index The callable generating the * @param callable|null $index The callable generating the
* view indices * view indices
* @param null|callable $groupBy The callable generating the * @param callable|null $groupBy The callable generating the
* group names * group names
* @param null|array|callable $attr The callable generating the * @param array|callable|null $attr The callable generating the
* HTML attributes * HTML attributes
* *
* @return ChoiceListView The choice list view * @return ChoiceListView The choice list view
Expand Down
Expand Up @@ -60,7 +60,7 @@ public function getDecoratedFactory()
* {@inheritdoc} * {@inheritdoc}
* *
* @param iterable $choices The choices * @param iterable $choices The choices
* @param null|callable|string|PropertyPath $value The callable or path for * @param callable|string|PropertyPath|null $value The callable or path for
* generating the choice values * generating the choice values
* *
* @return ChoiceListInterface The choice list * @return ChoiceListInterface The choice list
Expand Down Expand Up @@ -91,7 +91,7 @@ public function createListFromChoices($choices, $value = null)
* {@inheritdoc} * {@inheritdoc}
* *
* @param array|\Traversable $choices The choices * @param array|\Traversable $choices The choices
* @param null|callable|string|PropertyPath $value The callable or path for * @param callable|string|PropertyPath|null $value The callable or path for
* generating the choice values * generating the choice values
* *
* @return ChoiceListInterface The choice list * @return ChoiceListInterface The choice list
Expand All @@ -110,7 +110,7 @@ public function createListFromFlippedChoices($choices, $value = null, $triggerDe
* {@inheritdoc} * {@inheritdoc}
* *
* @param ChoiceLoaderInterface $loader The choice loader * @param ChoiceLoaderInterface $loader The choice loader
* @param null|callable|string|PropertyPath $value The callable or path for * @param callable|string|PropertyPath|null $value The callable or path for
* generating the choice values * generating the choice values
* *
* @return ChoiceListInterface The choice list * @return ChoiceListInterface The choice list
Expand Down Expand Up @@ -141,11 +141,11 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
* {@inheritdoc} * {@inheritdoc}
* *
* @param ChoiceListInterface $list The choice list * @param ChoiceListInterface $list The choice list
* @param null|array|callable|string|PropertyPath $preferredChoices The preferred choices * @param array|callable|string|PropertyPath|null $preferredChoices The preferred choices
* @param null|callable|string|PropertyPath $label The callable or path generating the choice labels * @param callable|string|PropertyPath|null $label The callable or path generating the choice labels
* @param null|callable|string|PropertyPath $index The callable or path generating the view indices * @param callable|string|PropertyPath|null $index The callable or path generating the view indices
* @param null|callable|string|PropertyPath $groupBy The callable or path generating the group names * @param callable|string|PropertyPath|null $groupBy The callable or path generating the group names
* @param null|array|callable|string|PropertyPath $attr The callable or path generating the HTML attributes * @param array|callable|string|PropertyPath|null $attr The callable or path generating the HTML attributes
* *
* @return ChoiceListView The choice list view * @return ChoiceListView The choice list view
*/ */
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php
Expand Up @@ -34,7 +34,7 @@ class LazyChoiceList implements ChoiceListInterface
* *
* If null, choices are simply cast to strings. * If null, choices are simply cast to strings.
* *
* @var null|callable * @var callable|null
*/ */
private $value; private $value;


Expand All @@ -51,7 +51,7 @@ class LazyChoiceList implements ChoiceListInterface
* argument. * argument.
* *
* @param ChoiceLoaderInterface $loader The choice loader * @param ChoiceLoaderInterface $loader The choice loader
* @param null|callable $value The callable generating the choice values * @param callable|null $value The callable generating the choice values
*/ */
public function __construct(ChoiceLoaderInterface $loader, $value = null) public function __construct(ChoiceLoaderInterface $loader, $value = null)
{ {
Expand Down
Expand Up @@ -31,7 +31,7 @@ interface ChoiceLoaderInterface
* The callable receives the choice as first and the array key as the second * The callable receives the choice as first and the array key as the second
* argument. * argument.
* *
* @param null|callable $value The callable which generates the values * @param callable|null $value The callable which generates the values
* from choices * from choices
* *
* @return ChoiceListInterface The loaded choice list * @return ChoiceListInterface The loaded choice list
Expand All @@ -50,7 +50,7 @@ public function loadChoiceList($value = null);
* *
* @param string[] $values An array of choice values. Non-existing * @param string[] $values An array of choice values. Non-existing
* values in this array are ignored * values in this array are ignored
* @param null|callable $value The callable generating the choice values * @param callable|null $value The callable generating the choice values
* *
* @return array An array of choices * @return array An array of choices
*/ */
Expand All @@ -68,7 +68,7 @@ public function loadChoicesForValues(array $values, $value = null);
* *
* @param array $choices An array of choices. Non-existing choices in * @param array $choices An array of choices. Non-existing choices in
* this array are ignored * this array are ignored
* @param null|callable $value The callable generating the choice values * @param callable|null $value The callable generating the choice values
* *
* @return string[] An array of choice values * @return string[] An array of choice values
*/ */
Expand Down
Expand Up @@ -32,7 +32,7 @@ class CsrfExtension extends AbstractExtension
/** /**
* @param CsrfTokenManagerInterface $tokenManager The CSRF token manager * @param CsrfTokenManagerInterface $tokenManager The CSRF token manager
* @param TranslatorInterface $translator The translator for translating error messages * @param TranslatorInterface $translator The translator for translating error messages
* @param null|string $translationDomain The translation domain for translating * @param string|null $translationDomain The translation domain for translating
*/ */
public function __construct($tokenManager, TranslatorInterface $translator = null, $translationDomain = null) public function __construct($tokenManager, TranslatorInterface $translator = null, $translationDomain = null)
{ {
Expand Down
Expand Up @@ -51,7 +51,7 @@ public static function getSubscribedEvents()
* same session and with the same tokenId * same session and with the same tokenId
* @param string $errorMessage The message displayed in case of an error * @param string $errorMessage The message displayed in case of an error
* @param TranslatorInterface $translator * @param TranslatorInterface $translator
* @param null|string $translationDomain * @param string|null $translationDomain
* @param ServerParams $serverParams * @param ServerParams $serverParams
*/ */
public function __construct($fieldName, $tokenManager, $tokenId, $errorMessage, TranslatorInterface $translator = null, $translationDomain = null, ServerParams $serverParams = null) public function __construct($fieldName, $tokenManager, $tokenId, $errorMessage, TranslatorInterface $translator = null, $translationDomain = null, ServerParams $serverParams = null)
Expand Down
Expand Up @@ -47,7 +47,7 @@ class FormTypeCsrfExtension extends AbstractTypeExtension
* @param bool $defaultEnabled * @param bool $defaultEnabled
* @param string $defaultFieldName * @param string $defaultFieldName
* @param TranslatorInterface $translator * @param TranslatorInterface $translator
* @param null|string $translationDomain * @param string|null $translationDomain
* @param ServerParams $serverParams * @param ServerParams $serverParams
*/ */
public function __construct($defaultTokenManager, $defaultEnabled = true, $defaultFieldName = '_token', TranslatorInterface $translator = null, $translationDomain = null, ServerParams $serverParams = null) public function __construct($defaultTokenManager, $defaultEnabled = true, $defaultFieldName = '_token', TranslatorInterface $translator = null, $translationDomain = null, ServerParams $serverParams = null)
Expand Down
Expand Up @@ -27,7 +27,7 @@ class UploadValidatorExtension extends AbstractTypeExtension


/** /**
* @param TranslatorInterface $translator The translator for translating error messages * @param TranslatorInterface $translator The translator for translating error messages
* @param null|string $translationDomain The translation domain for translating * @param string|null $translationDomain The translation domain for translating
*/ */
public function __construct(TranslatorInterface $translator, $translationDomain = null) public function __construct(TranslatorInterface $translator, $translationDomain = null)
{ {
Expand Down
Expand Up @@ -51,7 +51,7 @@ public function getOrigin()
* *
* @param string $propertyPath The property path to match against the rule * @param string $propertyPath The property path to match against the rule
* *
* @return null|FormInterface The mapped form or null * @return FormInterface|null The mapped form or null
*/ */
public function match($propertyPath) public function match($propertyPath)
{ {
Expand Down
Expand Up @@ -144,7 +144,7 @@ public function mapViolation(ConstraintViolation $violation, FormInterface $form
* @param FormInterface $form The form to search * @param FormInterface $form The form to search
* @param PropertyPathIteratorInterface $it The iterator at its current position * @param PropertyPathIteratorInterface $it The iterator at its current position
* *
* @return null|FormInterface The found match or null * @return FormInterface|null The found match or null
*/ */
private function matchChild(FormInterface $form, PropertyPathIteratorInterface $it) private function matchChild(FormInterface $form, PropertyPathIteratorInterface $it)
{ {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/FormConfigBuilderInterface.php
Expand Up @@ -146,7 +146,7 @@ public function setRequired($required);
/** /**
* Sets the property path that the form should be mapped to. * Sets the property path that the form should be mapped to.
* *
* @param null|string|PropertyPathInterface $propertyPath The property path or null if the path should be set * @param string|PropertyPathInterface|null $propertyPath The property path or null if the path should be set
* automatically based on the form's name * automatically based on the form's name
* *
* @return $this The configuration object * @return $this The configuration object
Expand Down

0 comments on commit 47f2aee

Please sign in to comment.