Skip to content

Commit fb28238

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: Fix minor syntax issues Rename variable to stay consistent Update http_client.rst [Routing] Add example of Requirement enum
2 parents 01203e9 + a61f328 commit fb28238

File tree

10 files changed

+97
-54
lines changed

10 files changed

+97
-54
lines changed

configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ a new ``locale`` parameter is added to the ``config/services.yaml`` file).
379379

380380
By convention, parameters whose names start with a dot ``.`` (for example,
381381
``.mailer.transport``), are available only during the container compilation.
382-
They are useful when working with :ref:`Compiler Passes </service_container/compiler_passes>`
382+
They are useful when working with :doc:`Compiler Passes </service_container/compiler_passes>`
383383
to declare some temporary parameters that won't be available later in the application.
384384

385385
Configuration parameters are usually validation-free, but you can ensure that

http_client.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,11 +2355,11 @@ First, use a browser or HTTP client to perform the HTTP request(s) you want to
23552355
test. Then, save that information as a ``.har`` file somewhere in your application::
23562356

23572357
// ExternalArticleServiceTest.php
2358-
use PHPUnit\Framework\TestCase;
2358+
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
23592359
use Symfony\Component\HttpClient\MockHttpClient;
23602360
use Symfony\Component\HttpClient\Response\MockResponse;
23612361

2362-
final class ExternalArticleServiceTest extends TestCase
2362+
final class ExternalArticleServiceTest extends KernelTestCase
23632363
{
23642364
public function testSubmitData(): void
23652365
{

messenger.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ Rate Limited Transport
958958
~~~~~~~~~~~~~~~~~~~~~~
959959

960960
Sometimes you might need to rate limit your message worker. You can configure a
961-
rate limiter on a transport (requires the :doc:`RateLimiter component </rate-limiter>`)
961+
rate limiter on a transport (requires the :doc:`RateLimiter component </rate_limiter>`)
962962
by setting its ``rate_limiter`` option:
963963

964964
.. configuration-block::

reference/attributes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Dependency Injection
3333
* :ref:`Autowire <autowire-attribute>`
3434
* :ref:`AutowireCallable <autowiring_closures>`
3535
* :doc:`AutowireDecorated </service_container/service_decoration>`
36-
* :doc:`AutowireIterator <service-locator_autowire-iterator>`
36+
* :ref:`AutowireIterator <service-locator_autowire-iterator>`
3737
* :ref:`AutowireLocator <service-locator_autowire-locator>`
3838
* :ref:`AutowireMethodOf <autowiring_closures>`
3939
* :ref:`AutowireServiceClosure <autowiring_closures>`

reference/configuration/framework.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,6 @@ named ``kernel.http_method_override``.
193193
$request = Request::createFromGlobals();
194194
// ...
195195

196-
.. _configuration-framework-http_method_override:
197-
198196
trust_x_sendfile_type_header
199197
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200198

reference/constraints/Callback.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,16 @@ callback method:
271271
* A closure.
272272

273273
Concrete callbacks receive an :class:`Symfony\\Component\\Validator\\Context\\ExecutionContextInterface`
274-
instance as the first argument and the :ref:`payload option <reference-constraints-payload>`
274+
instance as the first argument and the :ref:`payload option <reference-constraints-callback-payload>`
275275
as the second argument.
276276

277277
Static or closure callbacks receive the validated object as the first argument,
278278
the :class:`Symfony\\Component\\Validator\\Context\\ExecutionContextInterface`
279-
instance as the second argument and the :ref:`payload option <reference-constraints-payload>`
279+
instance as the second argument and the :ref:`payload option <reference-constraints-callback-payload>`
280280
as the third argument.
281281

282282
.. include:: /reference/constraints/_groups-option.rst.inc
283283

284+
.. _reference-constraints-callback-payload:
285+
284286
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/_payload-option.rst.inc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.. _reference-constraints-payload:
2-
31
``payload``
42
~~~~~~~~~~~
53

reference/dic_tags.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ controller.argument_value_resolver
335335
Value resolvers implement the
336336
:class:`Symfony\\Component\\HttpKernel\\Controller\\ValueResolverInterface`
337337
and are used to resolve argument values for controllers as described here:
338-
:doc:`/controller/argument_value_resolver`.
338+
:doc:`/controller/value_resolver`.
339339

340340
data_collector
341341
--------------

routing.rst

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,51 @@ URL Route Parameters
649649
contains a collection of commonly used regular-expression constants such as
650650
digits, dates and UUIDs which can be used as route parameter requirements.
651651

652+
.. configuration-block::
653+
654+
.. code-block:: php-attributes
655+
656+
// src/Controller/BlogController.php
657+
namespace App\Controller;
658+
659+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
660+
use Symfony\Component\HttpFoundation\Response;
661+
use Symfony\Component\Routing\Attribute\Route;
662+
use Symfony\Component\Routing\Requirement\Requirement;
663+
664+
class BlogController extends AbstractController
665+
{
666+
#[Route('/blog/{page}', name: 'blog_list', requirements: ['page' => Requirement::DIGITS])]
667+
public function list(int $page): Response
668+
{
669+
// ...
670+
}
671+
}
672+
673+
.. code-block:: yaml
674+
675+
# config/routes.yaml
676+
blog_list:
677+
path: /blog/{page}
678+
controller: App\Controller\BlogController::list
679+
requirements:
680+
page: !php/const Symfony\Component\Routing\Requirement\Requirement::DIGITS
681+
682+
.. code-block:: php
683+
684+
// config/routes.php
685+
use App\Controller\BlogController;
686+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
687+
use Symfony\Component\Routing\Requirement\Requirement;
688+
689+
return static function (RoutingConfigurator $routes): void {
690+
$routes->add('blog_list', '/blog/{page}')
691+
->controller([BlogController::class, 'list'])
692+
->requirements(['page' => Requirement::DIGITS])
693+
;
694+
// ...
695+
};
696+
652697
.. tip::
653698

654699
Route requirements (and route paths too) can include
@@ -2327,7 +2372,7 @@ the :class:`Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface` class
23272372
class SomeService
23282373
{
23292374
public function __construct(
2330-
private UrlGeneratorInterface $router,
2375+
private UrlGeneratorInterface $urlGenerator,
23312376
) {
23322377
}
23332378

@@ -2336,20 +2381,20 @@ the :class:`Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface` class
23362381
// ...
23372382

23382383
// generate a URL with no route arguments
2339-
$signUpPage = $this->router->generate('sign_up');
2384+
$signUpPage = $this->urlGenerator->generate('sign_up');
23402385

23412386
// generate a URL with route arguments
2342-
$userProfilePage = $this->router->generate('user_profile', [
2387+
$userProfilePage = $this->urlGenerator->generate('user_profile', [
23432388
'username' => $user->getUserIdentifier(),
23442389
]);
23452390

23462391
// generated URLs are "absolute paths" by default. Pass a third optional
23472392
// argument to generate different URLs (e.g. an "absolute URL")
2348-
$signUpPage = $this->router->generate('sign_up', [], UrlGeneratorInterface::ABSOLUTE_URL);
2393+
$signUpPage = $this->urlGenerator->generate('sign_up', [], UrlGeneratorInterface::ABSOLUTE_URL);
23492394

23502395
// when a route is localized, Symfony uses by default the current request locale
23512396
// pass a different '_locale' value if you want to set the locale explicitly
2352-
$signUpPageInDutch = $this->router->generate('sign_up', ['_locale' => 'nl']);
2397+
$signUpPageInDutch = $this->urlGenerator->generate('sign_up', ['_locale' => 'nl']);
23532398
}
23542399
}
23552400

service_container/service_decoration.rst

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -289,35 +289,35 @@ the ``decoration_priority`` option. Its value is an integer that defaults to
289289

290290
.. configuration-block::
291291

292-
.. code-block:: php-attributes
292+
.. code-block:: php-attributes
293293
294-
// ...
295-
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
296-
use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated;
294+
// ...
295+
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
296+
use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated;
297297
298-
#[AsDecorator(decorates: Foo::class, priority: 5)]
299-
class Bar
300-
{
301-
public function __construct(
302-
#[AutowireDecorated]
303-
private $inner,
304-
) {
305-
}
306-
// ...
298+
#[AsDecorator(decorates: Foo::class, priority: 5)]
299+
class Bar
300+
{
301+
public function __construct(
302+
#[AutowireDecorated]
303+
private $inner,
304+
) {
307305
}
306+
// ...
307+
}
308308
309-
#[AsDecorator(decorates: Foo::class, priority: 1)]
310-
class Baz
311-
{
312-
public function __construct(
313-
#[AutowireDecorated]
314-
private $inner,
315-
) {
316-
}
317-
318-
// ...
309+
#[AsDecorator(decorates: Foo::class, priority: 1)]
310+
class Baz
311+
{
312+
public function __construct(
313+
#[AutowireDecorated]
314+
private $inner,
315+
) {
319316
}
320317
318+
// ...
319+
}
320+
321321
.. code-block:: yaml
322322
323323
# config/services.yaml
@@ -609,24 +609,24 @@ Three different behaviors are available:
609609

610610
.. configuration-block::
611611

612-
.. code-block:: php-attributes
613-
614-
// ...
615-
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
616-
use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated;
617-
use Symfony\Component\DependencyInjection\ContainerInterface;
612+
.. code-block:: php-attributes
618613
619-
#[AsDecorator(decorates: Mailer::class, onInvalid: ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]
620-
class Bar
621-
{
622-
public function __construct(
623-
#[AutowireDecorated] private $inner,
624-
) {
625-
}
614+
// ...
615+
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
616+
use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated;
617+
use Symfony\Component\DependencyInjection\ContainerInterface;
626618
627-
// ...
619+
#[AsDecorator(decorates: Mailer::class, onInvalid: ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]
620+
class Bar
621+
{
622+
public function __construct(
623+
#[AutowireDecorated] private $inner,
624+
) {
628625
}
629626
627+
// ...
628+
}
629+
630630
.. code-block:: yaml
631631
632632
# config/services.yaml

0 commit comments

Comments
 (0)