diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 39de273..924aaa5 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -24,6 +24,12 @@ jobs: laravel: [8.*, 7.*, 6.*] dependency-version: [prefer-lowest, prefer-stable] include: + - laravel: 11.* + php: 8.3 + dependency-version: prefer-stable + - laravel: 11.* + php: 8.2 + dependency-version: prefer-stable - laravel: 10.* php: 8.2 dependency-version: prefer-stable diff --git a/composer.json b/composer.json index 1ed924d..afdab08 100644 --- a/composer.json +++ b/composer.json @@ -12,10 +12,10 @@ "require": { "php": "^7.2 || ^8.0", "dompdf/dompdf": "^2.0.3", - "illuminate/support": "^6|^7|^8|^9|^10" + "illuminate/support": "^6|^7|^8|^9|^10|^11" }, "require-dev": { - "orchestra/testbench": "^4|^5|^6|^7|^8", + "orchestra/testbench": "^4|^5|^6|^7|^8|^9", "squizlabs/php_codesniffer": "^3.5", "phpro/grumphp": "^1", "larastan/larastan": "^1.0|^2.7.0" diff --git a/src/Facade/Pdf.php b/src/Facade/Pdf.php index c32ff02..5b4215d 100644 --- a/src/Facade/Pdf.php +++ b/src/Facade/Pdf.php @@ -4,6 +4,7 @@ use Barryvdh\DomPDF\PDF as BasePDF; use Illuminate\Support\Facades\Facade as IlluminateFacade; +use RuntimeException; /** * @method static BasePDF setBaseHost(string $baseHost) @@ -43,14 +44,24 @@ protected static function getFacadeAccessor() } /** - * Resolve a new instance + * Handle dynamic, static calls to the object. + * * @param string $method * @param array $args * @return mixed + * + * @throws \RuntimeException */ public static function __callStatic($method, $args) { - $instance = static::$app->make(static::getFacadeAccessor()); + /** @var \Illuminate\Contracts\Foundation\Application|null */ + $app = static::getFacadeApplication(); + if (! $app) { + throw new RuntimeException('Facade application has not been set.'); + } + + // Resolve a new instance, avoid using a cached instance + $instance = $app->make(static::getFacadeAccessor()); return $instance->$method(...$args); }