safe
safe copied to clipboard
Imagick
It's a common extension and lots of their methods return false on failure, which is frustrating.
How would I go about adding it?
Great repo btw!
The current implementation of Safe rewrite only functions, and could not cover the Imagick classes.
Unless refactoring Safe in order to take Class into account and generate something like:
namespace Safe;
class Imagick extends \Imagick
{
public function fooBar(type $arg)
{
error_clear_last();
$result = parent::fooBar($arg);
if ($result === false) {
throw ApacheException::createFromPhpError();
}
return $result;
}
}
ping @moufmouf what do you think?
edit: duplicate of #7
Exactly! Overloading classes is harder than overloading functions and I haven't had time to crack the issue yet.
If anyone is feeling up to the task, do not hesitate to give me a hand :)