{"record":{"id":"f3d048d01653542e","repo":"Intervention/image","slug":"argument-driver-must-be-an-implementation-of-inte","errorCode":null,"errorMessage":"Argument $driver must be an implementation of Intervention\\Image\\Interfaces\\DriverInterface","messagePattern":"Argument \\$driver must be an implementation of Intervention\\\\Image\\\\Interfaces\\\\DriverInterface","errorType":"exception","errorClass":"Intervention\\Image\\Exceptions\\InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Traits/CanResolveDriver.php","lineNumber":26,"sourceCode":"use Intervention\\Image\\Interfaces\\DriverInterface;\n\ntrait CanResolveDriver\n{\n    /**\n     * Resolve given string or driver to a driver instance with given options.\n     *\n     * @throws InvalidArgumentException\n     */\n    protected static function resolveDriver(string|DriverInterface $driver, mixed ...$options): DriverInterface\n    {\n        if (is_string($driver) && !class_exists($driver)) {\n            throw new InvalidArgumentException(\n                'Argument $driver must be existing class name',\n            );\n        }\n\n        if (is_string($driver) && !is_subclass_of($driver, DriverInterface::class)) {\n            throw new InvalidArgumentException(\n                'Argument $driver must be an implementation of ' . DriverInterface::class,\n            );\n        }\n\n        $driver = is_string($driver) ? new $driver() : $driver;\n        $driver->config()->setOptions(...$options);\n\n        return $driver;\n    }\n}\n","sourceCodeStart":8,"sourceCodeEnd":37,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Traits/CanResolveDriver.php#L8-L37","documentation":"Error \"Argument $driver must be an implementation of Intervention\\Image\\Interfaces\\DriverInterface\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/Traits/CanResolveDriver.php:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a class that implements Intervention\\Image\\Interfaces\\DriverInterface (Gd\\Driver or Imagick\\Driver)","If using a custom driver, make it implement DriverInterface","Check use-statements so the resolved class is the intended driver, not a same-named class"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}