@@ -24,15 +24,15 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
24
24
25
25
.. configuration-block ::
26
26
27
- .. code-block :: php
27
+ .. code-block :: php-attributes
28
28
29
29
// index.php
30
30
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
31
31
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
32
32
use Symfony\Component\HttpFoundation\JsonResponse;
33
33
use Symfony\Component\HttpFoundation\Request;
34
34
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
35
- use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator ;
35
+ use Symfony\Component\Routing\Annotation\Route ;
36
36
37
37
require __DIR__.'/vendor/autoload.php';
38
38
@@ -55,11 +55,7 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
55
55
]);
56
56
}
57
57
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')]
63
59
public function randomNumber(int $limit): JsonResponse
64
60
{
65
61
return new JsonResponse([
@@ -74,15 +70,15 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
74
70
$response->send();
75
71
$kernel->terminate($request, $response);
76
72
77
- .. code-block :: php-attributes
73
+ .. code-block :: php
78
74
79
75
// index.php
80
76
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
81
77
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
82
78
use Symfony\Component\HttpFoundation\JsonResponse;
83
79
use Symfony\Component\HttpFoundation\Request;
84
80
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
85
- use Symfony\Component\Routing\Annotation\Route ;
81
+ use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator ;
86
82
87
83
require __DIR__.'/vendor/autoload.php';
88
84
@@ -105,7 +101,11 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
105
101
]);
106
102
}
107
103
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
+
109
109
public function randomNumber(int $limit): JsonResponse
110
110
{
111
111
return new JsonResponse([
0 commit comments