Skip to content

Removed some occurrences of explicitly talking about "PHP 8 attributes" #18433

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
Jun 20, 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
3 changes: 1 addition & 2 deletions console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ available in the ``configure()`` method::
Registering the Command
~~~~~~~~~~~~~~~~~~~~~~~

In PHP 8 and newer versions, you can register the command by adding the
``AsCommand`` attribute to it::
You can register the command by adding the ``AsCommand`` attribute to it::

// src/Command/CreateUserCommand.php
namespace App\Command;
Expand Down
4 changes: 2 additions & 2 deletions service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ each time you ask for it.
Limiting Services to a specific Symfony Environment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you are using PHP 8.0 or later, you can use the ``#[When]`` PHP
attribute to only register the class as a service in some environments::
You can use the ``#[When]`` attribute to only register the class
as a service in some environments::

use Symfony\Component\DependencyInjection\Attribute\When;

Expand Down
14 changes: 5 additions & 9 deletions service_container/calls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,20 +145,16 @@ The configuration to tell the container it should do so would be like:
If autowire is enabled, you can also use attributes; with the previous
example it would be::

/**
* @return static
*/
#[Required]
public function withLogger(LoggerInterface $logger)
public function withLogger(LoggerInterface $logger): static
{
$new = clone $this;
$new->logger = $logger;

return $new;
}

You can also leverage the PHP 8 ``static`` return type instead of the
``@return static`` annotation. If you don't want a method with a
PHP 8 ``static`` return type and a ``#[Required]`` attribute to behave as
a wither, you can add a ``@return $this`` annotation to disable the
*returns clone* feature.
If you don't want a method with a ``static`` return type and
a ``#[Required]`` attribute to behave as a wither, you can
add a ``@return $this`` annotation to disable the *returns clone*
feature.
2 changes: 1 addition & 1 deletion service_container/tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ In a Symfony bundle, call this method in the ``load()`` method of the
}

Autoconfiguration registering is not limited to interfaces. It is possible
to use PHP 8 attributes to autoconfigure services by using the
to use PHP attributes to autoconfigure services by using the
:method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::registerAttributeForAutoconfiguration`
method::

Expand Down