diff --git a/src/Facade/Pdf.php b/src/Facade/Pdf.php index 2994604..2babd45 100644 --- a/src/Facade/Pdf.php +++ b/src/Facade/Pdf.php @@ -45,28 +45,6 @@ public static function __callStatic($method, $args) { $instance = static::$app->make(static::getFacadeAccessor()); - switch (count($args)) { - case 0: - return $instance->$method(); - - case 1: - return $instance->$method($args[0]); - - case 2: - return $instance->$method($args[0], $args[1]); - - case 3: - return $instance->$method($args[0], $args[1], $args[2]); - - case 4: - return $instance->$method($args[0], $args[1], $args[2], $args[3]); - - default: - $callable = [$instance, $method]; - if (! is_callable($callable)) { - throw new \UnexpectedValueException("Method PDF::{$method}() does not exist."); - } - return call_user_func_array($callable, $args); - } + return $instance->$method(...$args); } } diff --git a/tests/PdfTest.php b/tests/PdfTest.php index 45f77ea..27bbe13 100644 --- a/tests/PdfTest.php +++ b/tests/PdfTest.php @@ -127,4 +127,16 @@ public function testSave(): void $this->assertNotEmpty($content); $this->assertEquals($content, $pdf->output()); } + + public function testMultipleInstances(): void + { + $pdf1 = Facade\Pdf::loadHtml('