Skip to content

Improve return types #18485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doctrine/associations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class that will hold these objects:
}

/**
* @return Collection|Product[]
* @return Collection<int, Product>
*/
public function getProducts(): Collection
{
Expand Down
2 changes: 1 addition & 1 deletion messenger/handler_results.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ wherever you need a query bus behavior instead of the ``MessageBusInterface``::
*
* @return mixed The handler returned value
*/
public function query($query)
public function query($query): mixed
{
return $this->handle($query);
}
Expand Down
2 changes: 0 additions & 2 deletions security/user_providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ command will generate a nice skeleton to get you started::
*
* If your firewall is "stateless: true" (for a pure API), this
* method is not called.
*
* @return UserInterface
*/
public function refreshUser(UserInterface $user): UserInterface
{
Expand Down
5 changes: 3 additions & 2 deletions service_container/injection_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ In order to use this type of injection, don't forget to configure it:
.. note::

If you decide to use autowiring, this type of injection requires
that you add a ``@return static`` docblock in order for the container
to be capable of registering the method.
that you add a ``@return static`` docblock or the ``static`` return
type in order for the container to be capable of registering
the method.

This approach is useful if you need to configure your service according to your needs,
so, here's the advantages of immutable-setters:
Expand Down