Skip to content

Commit ac95c90

Browse files
committed
Change the order of code blocks in the configuration block
1 parent d0828e1 commit ac95c90

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

configuration/micro_kernel_trait.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
2424

2525
.. configuration-block::
2626

27-
.. code-block:: php
27+
.. code-block:: php-attributes
2828
2929
// index.php
3030
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
3131
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
3232
use Symfony\Component\HttpFoundation\JsonResponse;
3333
use Symfony\Component\HttpFoundation\Request;
3434
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
35-
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
35+
use Symfony\Component\Routing\Annotation\Route;
3636
3737
require __DIR__.'/vendor/autoload.php';
3838
@@ -55,11 +55,7 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
5555
]);
5656
}
5757
58-
protected function configureRoutes(RoutingConfigurator $routes): void
59-
{
60-
$routes->add('random_number', '/random/{limit}')->controller([$this, 'randomNumber']);
61-
}
62-
58+
#[Route('/random/{limit}', name='random_number')]
6359
public function randomNumber(int $limit): JsonResponse
6460
{
6561
return new JsonResponse([
@@ -74,15 +70,15 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
7470
$response->send();
7571
$kernel->terminate($request, $response);
7672
77-
.. code-block:: php-attributes
73+
.. code-block:: php
7874
7975
// index.php
8076
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
8177
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
8278
use Symfony\Component\HttpFoundation\JsonResponse;
8379
use Symfony\Component\HttpFoundation\Request;
8480
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
85-
use Symfony\Component\Routing\Annotation\Route;
81+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
8682
8783
require __DIR__.'/vendor/autoload.php';
8884
@@ -105,7 +101,11 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
105101
]);
106102
}
107103
108-
#[Route('/random/{limit}', name='random_number')]
104+
protected function configureRoutes(RoutingConfigurator $routes): void
105+
{
106+
$routes->add('random_number', '/random/{limit}')->controller([$this, 'randomNumber']);
107+
}
108+
109109
public function randomNumber(int $limit): JsonResponse
110110
{
111111
return new JsonResponse([

0 commit comments

Comments
 (0)