From 005736023612ec284aad2d64d0b25afdcb9496c7 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Tue, 12 Nov 2024 19:19:30 +0100 Subject: [PATCH] Modernize example for SentryTestController to PHP 8 and Symfony Since Symfony 5.2 PHP Attributes can be used instead of the old annotations. Updated also the Syntax to make the test easier. --- docs/platforms/php/guides/symfony/index.mdx | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/docs/platforms/php/guides/symfony/index.mdx b/docs/platforms/php/guides/symfony/index.mdx index f7dc760bd52401..75288b2eb3d6b0 100644 --- a/docs/platforms/php/guides/symfony/index.mdx +++ b/docs/platforms/php/guides/symfony/index.mdx @@ -44,23 +44,15 @@ namespace App\Controller; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; class SentryTestController extends AbstractController { - /** - * @var LoggerInterface - */ - private $logger; - - public function __construct(LoggerInterface $logger) + public function __construct(private LoggerInterface $logger) { - $this->logger = $logger; } - /** - * @Route(name="sentry_test", path="/_sentry-test") - */ + #[Route('/_sentry-test', name: 'sentry_test')] public function testLog() { // the following code will test if monolog integration logs to sentry