Repository: getsentry/sentry-laravel (php)

Issue:
Type mismatch for description argument when accessing files
### How do you use Sentry?

Sentry SaaS (sentry.io)

### SDK version

3.7.0

### Steps to reproduce

1. Install Sentry as per the [guide](https://docs.sentry.io/platforms/php/guides/laravel/)
2. Execute the following code

`/routes/web.php`

```php
Route::get('/', function () {
    app(\Illuminate\Filesystem\FilesystemManager::class)->disk('local')->files();
});
```

### Expected result

No error

### Actual result

```
Sentry\Laravel\Features\Storage\SentryFilesystem::withSentry(): Argument #3 ($description) must be of type string, null given, called in /tmp/tmp.WVmvUY3TWW/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Features/Storage/SentryFilesystem.php on line 182
```

![20230801-1122](https://github.com/getsentry/sentry-laravel/assets/10062339/46884077-d4c3-4a09-b2ba-0614d084fd72)



Pull request:
Fix null description not allowed
Fixes #749.

When using `Storage::files()` (without argument) the description is `null` which was not accepted by the `withSentry` helper even though valid in spans and breadcrumbs.

Patch:
diff --git a/src/Sentry/Laravel/Features/Storage/SentryFilesystem.php b/src/Sentry/Laravel/Features/Storage/SentryFilesystem.php
index 9452192..6bb7508 100644
--- a/src/Sentry/Laravel/Features/Storage/SentryFilesystem.php
+++ b/src/Sentry/Laravel/Features/Storage/SentryFilesystem.php
@@ -46,7 +46,7 @@ class SentryFilesystem implements Filesystem
      *
      * @return mixed
      */
-    protected function withSentry(string $method, array $args, string $description, array $data)
+    protected function withSentry(string $method, array $args, ?string $description, array $data)
     {
         $op = "file.{$method}"; // See https://develop.sentry.dev/sdk/performance/span-operations/#web-server
         $data = array_merge($data, $this->defaultData);


Test patch:
diff --git a/test/Sentry/Features/StorageIntegrationTest.php b/test/Sentry/Features/StorageIntegrationTest.php
index 9f6e41b..684c738 100644
--- a/test/Sentry/Features/StorageIntegrationTest.php
+++ b/test/Sentry/Features/StorageIntegrationTest.php
@@ -29,6 +29,7 @@ class StorageIntegrationTest extends TestCase
         Storage::assertExists('foo', 'bar');
         Storage::delete('foo');
         Storage::delete(['foo', 'bar']);
+        Storage::files();
 
         $spans = $transaction->getSpanRecorder()->getSpans();
 
@@ -62,6 +63,12 @@ class StorageIntegrationTest extends TestCase
         $this->assertSame('file.delete', $span->getOp());
         $this->assertSame('2 paths', $span->getDescription());
         $this->assertSame(['paths' => ['foo', 'bar'], 'disk' => 'local', 'driver' => 'local'], $span->getData());
+
+        $this->assertArrayHasKey(6, $spans);
+        $span = $spans[6];
+        $this->assertSame('file.files', $span->getOp());
+        $this->assertNull($span->getDescription());
+        $this->assertSame(['directory' => null, 'recursive' => false, 'disk' => 'local', 'driver' => 'local'], $span->getData());
     }
 
     public function testDoesntCreateSpansWhenDisabled(): void
@@ -99,6 +106,7 @@ class StorageIntegrationTest extends TestCase
         Storage::assertExists('foo', 'bar');
         Storage::delete('foo');
         Storage::delete(['foo', 'bar']);
+        Storage::files();
 
         $breadcrumbs = $this->getCurrentBreadcrumbs();
 
@@ -132,6 +140,12 @@ class StorageIntegrationTest extends TestCase
         $this->assertSame('file.delete', $span->getCategory());
         $this->assertSame('2 paths', $span->getMessage());
         $this->assertSame(['paths' => ['foo', 'bar'], 'disk' => 'local', 'driver' => 'local'], $span->getMetadata());
+
+        $this->assertArrayHasKey(5, $breadcrumbs);
+        $span = $breadcrumbs[5];
+        $this->assertSame('file.files', $span->getCategory());
+        $this->assertNull($span->getMessage());
+        $this->assertSame(['directory' => null, 'recursive' => false, 'disk' => 'local', 'driver' => 'local'], $span->getMetadata());
     }
 
     public function testDoesntCreateBreadcrumbsWhenDisabled(): void