Skip to content

Commit 0057360

Browse files
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.
1 parent 6559e11 commit 0057360

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

docs/platforms/php/guides/symfony/index.mdx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,15 @@ namespace App\Controller;
4444

4545
use Psr\Log\LoggerInterface;
4646
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
47-
use Symfony\Component\Routing\Annotation\Route;
47+
use Symfony\Component\Routing\Attribute\Route;
4848

4949
class SentryTestController extends AbstractController
5050
{
51-
/**
52-
* @var LoggerInterface
53-
*/
54-
private $logger;
55-
56-
public function __construct(LoggerInterface $logger)
51+
public function __construct(private LoggerInterface $logger)
5752
{
58-
$this->logger = $logger;
5953
}
6054

61-
/**
62-
* @Route(name="sentry_test", path="/_sentry-test")
63-
*/
55+
#[Route('/_sentry-test', name: 'sentry_test')]
6456
public function testLog()
6557
{
6658
// the following code will test if monolog integration logs to sentry

0 commit comments

Comments
 (0)