diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 20b7cf94..7c566f3c 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,3 +2,6 @@ parameters: paths: - src level: 8 + ignoreErrors: + - "#Class Laravel\\\\Telescope\\\\Contracts\\\\EntriesRepository not found#" + - "#Call to static method store\\(\\) on an unknown class Laravel\\\\Telescope\\\\Telescope#" diff --git a/src/Commands/CheckCommand.php b/src/Commands/CheckCommand.php index 004bc7ae..fb08957e 100644 --- a/src/Commands/CheckCommand.php +++ b/src/Commands/CheckCommand.php @@ -68,6 +68,8 @@ public function handle( $pulse->ingest(); + $this->ensureTelescopeEntriesAreCollected(); + if ($isVapor || $this->option('once')) { return self::SUCCESS; } @@ -75,4 +77,14 @@ public function handle( Sleep::until($now->addSecond()); } } + + /** + * Schedule Telescope to store entries if enabled. + */ + protected function ensureTelescopeEntriesAreCollected(): void + { + if ($this->laravel->bound(\Laravel\Telescope\Contracts\EntriesRepository::class)) { + \Laravel\Telescope\Telescope::store($this->laravel->make(\Laravel\Telescope\Contracts\EntriesRepository::class)); + } + } }