1 | <?php |
||
11 | class Image |
||
12 | { |
||
13 | /** @var string */ |
||
14 | protected $pathToImage; |
||
15 | |||
16 | /** @var \Spatie\Image\Manipulations */ |
||
17 | protected $manipulations; |
||
18 | |||
19 | protected $imageDriver = 'gd'; |
||
20 | |||
21 | /** @var string|null */ |
||
22 | protected $temporaryDirectory = null; |
||
23 | |||
24 | /** |
||
25 | * @param string $pathToImage |
||
26 | * |
||
27 | * @return static |
||
28 | */ |
||
29 | public static function load(string $pathToImage) |
||
30 | { |
||
31 | return new static($pathToImage); |
||
32 | } |
||
33 | |||
34 | public function setTemporaryDirectory($tempDir) |
||
35 | { |
||
36 | $this->temporaryDirectory = $tempDir; |
||
37 | |||
38 | return $this; |
||
39 | } |
||
40 | |||
41 | public function __construct(string $pathToImage) |
||
42 | { |
||
43 | $this->pathToImage = $pathToImage; |
||
44 | |||
45 | $this->manipulations = new Manipulations(); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param string $imageDriver |
||
50 | * |
||
51 | * @return $this |
||
52 | * |
||
53 | * @throws InvalidImageDriver |
||
54 | */ |
||
55 | public function useImageDriver(string $imageDriver) |
||
69 | |||
70 | /** |
||
71 | * @param callable|$manipulations |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | public function manipulate($manipulations) |
||
87 | |||
88 | public function __call($name, $arguments) |
||
98 | |||
99 | public function getWidth(): int |
||
103 | |||
104 | public function getHeight(): int |
||
108 | |||
109 | public function getManipulationSequence(): ManipulationSequence |
||
113 | |||
114 | public function save($outputPath = '') |
||
115 | { |
||
116 | if ($outputPath == '') { |
||
140 | |||
141 | protected function shouldOptimize(): bool |
||
145 | |||
146 | protected function performOptimization($path, array $optimizerChainConfiguration) |
||
160 | |||
161 | protected function addFormatManipulation($outputPath) |
||
180 | } |
||
181 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: