Skip to content

Commit

Permalink
Fix Lumen compatibility (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia authored Jun 19, 2023
1 parent 43eb17b commit 16f19ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ See [GitHub releases](https://github.com/mll-lab/laravel-graphiql/releases).

## Unreleased

## v3.0.1

### Fixed

- Fix Lumen compatibility

## v3.0.0

### Removed
Expand Down
2 changes: 1 addition & 1 deletion src/DownloadAssetsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function downloadFileFromCDN(string $localPath, string $cdnPath): void
}

$contents = file_get_contents("https:{$cdnPath}");
if (false === $contents) {
if ($contents === false) {
$error = error_get_last();
throw new \ErrorException($error['message'] ?? 'An error occurred', 0, $error['type'] ?? 1);
}
Expand Down
4 changes: 1 addition & 3 deletions src/GraphiQLController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace MLL\GraphiQL;

use Illuminate\Config\Repository as ConfigRepository;
use Illuminate\Contracts\Routing\UrlGenerator;
use Illuminate\Contracts\View\Factory as ViewFactory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\Request;
Expand All @@ -12,7 +11,6 @@
class GraphiQLController
{
public function __construct(
protected UrlGenerator $urlGenerator,
protected ViewFactory $viewFactory,
) {}

Expand All @@ -34,7 +32,7 @@ public function __invoke(ConfigRepository $config, Request $request): View
protected function maybeURL(?string $endpoint): ?string
{
return is_string($endpoint) && filter_var($endpoint, FILTER_VALIDATE_URL)
? $this->urlGenerator->to($endpoint)
? url($endpoint) // Avoid injecting UrlGenerator for Lumen compatibility
: $endpoint;
}
}

0 comments on commit 16f19ce

Please sign in to comment.