Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Nov 12, 2024
1 parent 32136e4 commit 0450cc5
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 0 additions & 6 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/OriginFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/RayServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand All @@ -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;
});
Expand Down
1 change: 1 addition & 0 deletions src/Watchers/CacheWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function register(): void

$ray = $this->ray()->sendRequest($payload);

/** @phpstan-ignore method.notFound */
optional($this->rayProxy)->applyCalledMethods($ray);
});

Expand Down
1 change: 1 addition & 0 deletions src/Watchers/DuplicateQueryWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function register(): void

$ray = app(Ray::class)->sendRequest($payload);

/** @phpstan-ignore method.notFound */
optional($this->rayProxy)->applyCalledMethods($ray);
});
}
Expand Down
1 change: 1 addition & 0 deletions src/Watchers/EventWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function register(): void

$ray = app(Ray::class)->sendRequest($payload);

/** @phpstan-ignore method.notFound */
optional($this->rayProxy)->applyCalledMethods($ray);
});
}
Expand Down
1 change: 1 addition & 0 deletions src/Watchers/ExceptionWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 2 additions & 0 deletions src/Watchers/HttpClientWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function register(): void

$ray = $this->handleRequest($event->request);

/** @phpstan-ignore method.notFound */
optional($this->rayProxy)->applyCalledMethods($ray);
});

Expand All @@ -40,6 +41,7 @@ public function register(): void

$ray = $this->handleResponse($event->request, $event->response);

/** @phpstan-ignore method.notFound */
optional($this->rayProxy)->applyCalledMethods($ray);
});
}
Expand Down
1 change: 1 addition & 0 deletions src/Watchers/JobWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function register(): void

$ray = app(Ray::class)->sendRequest($payload);

/** @phpstan-ignore method.notFound */
optional($this->rayProxy)->applyCalledMethods($ray);
});
}
Expand Down
1 change: 1 addition & 0 deletions src/Watchers/QueryWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function register(): void

$ray = app(Ray::class)->sendRequest($payload);

/** @phpstan-ignore method.notFound */
optional($this->rayProxy)->applyCalledMethods($ray);
});
}
Expand Down
5 changes: 3 additions & 2 deletions src/Watchers/RequestWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function register(): void

$ray = $this->handleRequest($event->request, $event->response);

/** @phpstan-ignore method.notFound */
optional($this->rayProxy)->applyCalledMethods($ray);
});
}
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/Watchers/SlowQueryWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function register(): void
$ray->sendRequest($payload);
}

/** @phpstan-ignore method.notFound */
optional($this->rayProxy)->applyCalledMethods($ray);
});
}
Expand Down
1 change: 1 addition & 0 deletions src/Watchers/ViewWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function register(): void

$ray = app(Ray::class)->view($view);

/** @phpstan-ignore method.notFound */
optional($this->rayProxy)->applyCalledMethods($ray);
});
}
Expand Down

0 comments on commit 0450cc5

Please sign in to comment.