Skip to content

Commit

Permalink
Remove type check
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Oct 3, 2023
1 parent b57717d commit bc69b93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions src/Traits/CanHandleInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,15 @@

namespace Intervention\Image\Traits;

use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\ImageInterface;

trait CanHandleInput
{
use CanResolveDriverClass;

public function handleInput($input, ?string $check_result_against_classname = null): ImageInterface|ColorInterface
public function handleInput($input): ImageInterface|ColorInterface
{
$result = $this->resolveDriverClass('InputHandler')->handle($input);

if (!is_null($check_result_against_classname) && get_class($result) != $check_result_against_classname) {
throw new DecoderException('Decoded result is not an instance of ' . $check_result_against_classname);
}

return $result;
return $this->resolveDriverClass('InputHandler')->handle($input);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function backgroundColor(): ColorInterface
return parent::backgroundColor();
}

public function handleInput($input, ?string $check_result_against_classname = null): ImageInterface|ColorInterface
public function handleInput($input): ImageInterface|ColorInterface
{
if ($this->background === 'bad value') {
throw new DecoderException();
Expand Down

0 comments on commit bc69b93

Please sign in to comment.