diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index a552d04..95de501 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -18,4 +18,4 @@ jobs: uses: ramsey/composer-install@v3 - name: Run PHPStan - run: vendor/bin/phpstan --error-format=github + run: vendor/bin/phpstan --error-format=github --verbose diff --git a/composer.json b/composer.json index caa7203..8e7bb3d 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "laravel/framework": "^7.20|^8.19|^9.0|^10.0|^11.0", "orchestra/testbench-core": "^5.0|^6.0|^7.0|^8.0|^9.0", "pestphp/pest": "^1.22|^2.0", - "phpstan/phpstan": "^1.10.57", + "phpstan/phpstan": "^1.11", "phpunit/phpunit": "^9.3|^10.1", "spatie/pest-plugin-snapshots": "^1.1|^2.0", "symfony/var-dumper": "^4.2|^5.1|^6.0|^7.0.3" diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 2c029ab..c5e840f 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -11,9 +11,3 @@ parameters: - '#^Call to method \w+\(\) on an unknown class Spatie\\WordPressRay\\Ray\.$#' - '#^Call to method \w+\(\) on an unknown class Spatie\\RayBundle\\Ray\.$#' - '#^Access to an undefined property Spatie\\Ray\\Settings\\Settings\:\:\$\w+\.$#' - - - message: '#^Access to an undefined property Spatie\\LaravelRay\\RayServiceProvider\:\:\$items\.$#' - path: src/RayServiceProvider.php - - - message: '#^Access to an undefined property Spatie\\LaravelRay\\RayServiceProvider\:\:\$value\.$#' - path: src/RayServiceProvider.php diff --git a/src/OriginFactory.php b/src/OriginFactory.php index 0d29864..28d2de4 100644 --- a/src/OriginFactory.php +++ b/src/OriginFactory.php @@ -29,8 +29,8 @@ public function getOrigin(): Origin $frame = $this->getFrame(); return new Origin( - optional($frame)->file, - optional($frame)->lineNumber, + optional($frame)->file, // @phpstan-ignore property.notFound + optional($frame)->lineNumber, // @phpstan-ignore property.notFound ); } diff --git a/src/RayServiceProvider.php b/src/RayServiceProvider.php index 489185c..a82b102 100644 --- a/src/RayServiceProvider.php +++ b/src/RayServiceProvider.php @@ -191,8 +191,8 @@ protected function registerMacros(): self { Collection::macro('ray', function (string $description = '') { $description === '' - ? ray($this->items) - : ray($description, $this->items); + ? ray($this->items) // @phpstan-ignore property.protected + : ray($description, $this->items); // @phpstan-ignore property.protected return $this; }); @@ -206,8 +206,8 @@ protected function registerMacros(): self Stringable::macro('ray', function (string $description = '') { $description === '' - ? ray($this->value) - : ray($description, $this->value); + ? ray($this->value) // @phpstan-ignore property.protected + : ray($description, $this->value); // @phpstan-ignore property.protected return $this; }); diff --git a/src/Watchers/CacheWatcher.php b/src/Watchers/CacheWatcher.php index 87aeaae..bfeb1d7 100644 --- a/src/Watchers/CacheWatcher.php +++ b/src/Watchers/CacheWatcher.php @@ -27,6 +27,7 @@ public function register(): void $ray = $this->ray()->sendRequest($payload); + /** @phpstan-ignore method.notFound */ optional($this->rayProxy)->applyCalledMethods($ray); }); diff --git a/src/Watchers/DuplicateQueryWatcher.php b/src/Watchers/DuplicateQueryWatcher.php index b1ae461..6972d6a 100644 --- a/src/Watchers/DuplicateQueryWatcher.php +++ b/src/Watchers/DuplicateQueryWatcher.php @@ -40,6 +40,7 @@ public function register(): void $ray = app(Ray::class)->sendRequest($payload); + /** @phpstan-ignore method.notFound */ optional($this->rayProxy)->applyCalledMethods($ray); }); } diff --git a/src/Watchers/EventWatcher.php b/src/Watchers/EventWatcher.php index 80564e9..0b623b2 100644 --- a/src/Watchers/EventWatcher.php +++ b/src/Watchers/EventWatcher.php @@ -19,6 +19,7 @@ public function register(): void $ray = app(Ray::class)->sendRequest($payload); + /** @phpstan-ignore method.notFound */ optional($this->rayProxy)->applyCalledMethods($ray); }); } diff --git a/src/Watchers/ExceptionWatcher.php b/src/Watchers/ExceptionWatcher.php index b417dfb..42b949f 100644 --- a/src/Watchers/ExceptionWatcher.php +++ b/src/Watchers/ExceptionWatcher.php @@ -63,6 +63,7 @@ public function getFlareReport(Throwable $exception): ?array if (app()->bound(Flare::class)) { $flare = app(Flare::class); + /** @phpstan-ignore class.notFound */ $report = $flare->createReport($exception); return (new ReportTrimmer())->trim($report->toArray()); diff --git a/src/Watchers/HttpClientWatcher.php b/src/Watchers/HttpClientWatcher.php index 2ceaab0..8d1e283 100644 --- a/src/Watchers/HttpClientWatcher.php +++ b/src/Watchers/HttpClientWatcher.php @@ -30,6 +30,7 @@ public function register(): void $ray = $this->handleRequest($event->request); + /** @phpstan-ignore method.notFound */ optional($this->rayProxy)->applyCalledMethods($ray); }); @@ -40,6 +41,7 @@ public function register(): void $ray = $this->handleResponse($event->request, $event->response); + /** @phpstan-ignore method.notFound */ optional($this->rayProxy)->applyCalledMethods($ray); }); } diff --git a/src/Watchers/JobWatcher.php b/src/Watchers/JobWatcher.php index 394bb95..9b4816c 100644 --- a/src/Watchers/JobWatcher.php +++ b/src/Watchers/JobWatcher.php @@ -33,6 +33,7 @@ public function register(): void $ray = app(Ray::class)->sendRequest($payload); + /** @phpstan-ignore method.notFound */ optional($this->rayProxy)->applyCalledMethods($ray); }); } diff --git a/src/Watchers/QueryWatcher.php b/src/Watchers/QueryWatcher.php index 7a8efef..cd82e4d 100644 --- a/src/Watchers/QueryWatcher.php +++ b/src/Watchers/QueryWatcher.php @@ -43,6 +43,7 @@ public function register(): void $ray = app(Ray::class)->sendRequest($payload); + /** @phpstan-ignore method.notFound */ optional($this->rayProxy)->applyCalledMethods($ray); }); } diff --git a/src/Watchers/RequestWatcher.php b/src/Watchers/RequestWatcher.php index 60cc90e..770ccd4 100644 --- a/src/Watchers/RequestWatcher.php +++ b/src/Watchers/RequestWatcher.php @@ -30,6 +30,7 @@ public function register(): void $ray = $this->handleRequest($event->request, $event->response); + /** @phpstan-ignore method.notFound */ optional($this->rayProxy)->applyCalledMethods($ray); }); } @@ -54,8 +55,8 @@ protected function handleRequest(Request $request, Response $response): Ray 'IP Address' => $request->ip(), 'URI' => str_replace($request->root(), '', $request->fullUrl()) ?: '/', 'Method' => $request->method(), - 'Controller action' => optional($request->route())->getActionName(), - 'Middleware' => array_values(optional($request->route())->gatherMiddleware() ?? []), + 'Controller action' => optional($request->route())->getActionName(), // @phpstan-ignore method.notFound + 'Middleware' => array_values(optional($request->route())->gatherMiddleware() ?? []), // @phpstan-ignore method.notFound 'Headers' => $headers, 'Payload' => $this->payload($request), 'Session' => $session, diff --git a/src/Watchers/SlowQueryWatcher.php b/src/Watchers/SlowQueryWatcher.php index ce0f880..05d6dff 100644 --- a/src/Watchers/SlowQueryWatcher.php +++ b/src/Watchers/SlowQueryWatcher.php @@ -32,6 +32,7 @@ public function register(): void $ray->sendRequest($payload); } + /** @phpstan-ignore method.notFound */ optional($this->rayProxy)->applyCalledMethods($ray); }); } diff --git a/src/Watchers/ViewWatcher.php b/src/Watchers/ViewWatcher.php index ef65713..a95158a 100644 --- a/src/Watchers/ViewWatcher.php +++ b/src/Watchers/ViewWatcher.php @@ -24,6 +24,7 @@ public function register(): void $ray = app(Ray::class)->view($view); + /** @phpstan-ignore method.notFound */ optional($this->rayProxy)->applyCalledMethods($ray); }); }