Browse Source

fix(getting-started-docs): Tweak php docs (#53445)

Priscila Oliveira 1 year ago
parent
commit
7eef24a085

+ 14 - 10
static/app/gettingStartedDocs/php/laravel.tsx

@@ -7,16 +7,20 @@ import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
 import {t, tct} from 'sentry/locale';
 
 // Configuration Start
-const introduction = tct(
-  'This guide is for Laravel 8+. We also provide instructions for [otherVersionsLink:other versions] as well as [lumenSpecificLink:Lumen-specific instructions].',
-  {
-    otherVersionsLink: (
-      <ExternalLink href="https://docs.sentry.io/platforms/php/guides/laravel/other-versions/" />
-    ),
-    lumenSpecificLink: (
-      <ExternalLink href="https://docs.sentry.io/platforms/php/guides/laravel/other-versions/lumen/" />
-    ),
-  }
+const introduction = (
+  <p>
+    {tct(
+      'This guide is for Laravel 8+. We also provide instructions for [otherVersionsLink:other versions] as well as [lumenSpecificLink:Lumen-specific instructions].',
+      {
+        otherVersionsLink: (
+          <ExternalLink href="https://docs.sentry.io/platforms/php/guides/laravel/other-versions/" />
+        ),
+        lumenSpecificLink: (
+          <ExternalLink href="https://docs.sentry.io/platforms/php/guides/laravel/other-versions/lumen/" />
+        ),
+      }
+    )}
+  </p>
 );
 
 export const steps = ({

+ 4 - 4
static/app/gettingStartedDocs/php/php.tsx

@@ -39,7 +39,7 @@ export const steps = ({
     configurations: [
       {
         language: 'php',
-        code: `\Sentry\init(['dsn' => '${dsn}' ]);`,
+        code: `\\Sentry\\init(['dsn' => '${dsn}' ]);`,
       },
     ],
   },
@@ -54,13 +54,13 @@ export const steps = ({
         code: `
 try {
   $this->functionFailsForSure();
-} catch (\Throwable $exception) {
-  \Sentry\captureException($exception);
+} catch (\\Throwable $exception) {
+  \\Sentry\\captureException($exception);
 }
 
 // OR
 
-\Sentry\captureLastError();
+\\Sentry\\captureLastError();
         `,
       },
     ],

+ 13 - 13
static/app/gettingStartedDocs/php/symfony.tsx

@@ -106,11 +106,11 @@ SENTRY_DSN="${dsn}"
         code: `
 <?php
 
-namespace App\Controller;
+namespace App\\Controller;
 
-use Psr\Log\LoggerInterface;
-use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
-use Symfony\Component\Routing\Annotation\Route;
+use Psr\\Log\\LoggerInterface;
+use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;
+use Symfony\\Component\\Routing\\Annotation\\Route;
 
 class SentryTestController extends AbstractController {
   /**
@@ -132,7 +132,7 @@ class SentryTestController extends AbstractController {
     $this->logger->error('My custom logged error.');
 
     // the following code will test if an uncaught exception logs to sentry
-    throw new \RuntimeException('Example exception.');
+    throw new \\RuntimeException('Example exception.');
   }
 }
         `,
@@ -188,7 +188,7 @@ class SentryTestController extends AbstractController {
 
   return [
     // ...
-    Sentry\SentryBundle\SentryBundle::class => ['all' => true],
+    Sentry\\SentryBundle\\SentryBundle::class => ['all' => true],
   ];
         `,
       },
@@ -218,8 +218,8 @@ monolog:
   handlers:
     sentry:
       type: sentry
-      level: !php/const Monolog\Logger::ERROR
-      hub_id: Sentry\State\HubInterface
+      level: !php/const Monolog\\Logger::ERROR
+      hub_id: Sentry\\State\\HubInterface
         `,
       },
       {
@@ -242,13 +242,13 @@ monolog:
   handlers:
     sentry:
       type: service
-      id: Sentry\Monolog\Handler
+      id: Sentry\\Monolog\\Handler
 
 services:
-  Sentry\Monolog\Handler:
+  Sentry\\Monolog\\Handler:
     arguments:
-      $hub: '@Sentry\State\HubInterface'
-      $level: !php/const Monolog\Logger::ERROR
+      $hub: '@Sentry\\State\\HubInterface'
+      $level: !php/const Monolog\\Logger::ERROR
         `,
       },
       {
@@ -265,7 +265,7 @@ services:
         language: 'yaml',
         code: `
 services:
-  Monolog\Processor\PsrLogMessageProcessor:
+  Monolog\\Processor\\PsrLogMessageProcessor:
     tags: { name: monolog.processor, handler: sentry }
         `,
       },