diff --git a/changelog.md b/changelog.md index 67785e1b..ec00c9ee 100644 --- a/changelog.md +++ b/changelog.md @@ -27,3 +27,4 @@ - Signature of ImageInterface::place() changed `offset_x` is no `x` and `offset_y` is now `y` - EncodedImageInterface::toDataUri() now returns `DataUriInterface` instead of `string“ - ProfileInterface requires implementation of `::fromPath()` +- DriverInterface requires implementation of `__construct()` diff --git a/src/Drivers/AbstractDriver.php b/src/Drivers/AbstractDriver.php index 9b34c3d7..696f0ad8 100644 --- a/src/Drivers/AbstractDriver.php +++ b/src/Drivers/AbstractDriver.php @@ -23,18 +23,11 @@ use ReflectionClass; abstract class AbstractDriver implements DriverInterface { - /** - * Driver options - */ - protected Config $config; - /** * @throws DriverException - * @return void */ - public function __construct() + public function __construct(protected Config $config = new Config()) { - $this->config = new Config(); $this->checkHealth(); } diff --git a/src/Interfaces/DriverInterface.php b/src/Interfaces/DriverInterface.php index 6f69f46c..52dad20e 100644 --- a/src/Interfaces/DriverInterface.php +++ b/src/Interfaces/DriverInterface.php @@ -15,6 +15,11 @@ use Intervention\Image\MediaType; interface DriverInterface { + /** + * Create new driver instance with configuration + */ + public function __construct(Config $config); + /** * Return drivers unique id */