Skip to content

Commit ec6d502

Browse files
Explicitly mark parameters as nullable (#340)
1 parent dfbe53c commit ec6d502

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/claviska/SimpleImage.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public function fromString(string $string): SimpleImage|static
331331
*
332332
* @throws Exception Thrown when WEBP support is not enabled or unsupported format.
333333
*/
334-
public function generate(string $mimeType = null, array|int $options = 100): array
334+
public function generate(string|null $mimeType = null, array|int $options = 100): array
335335
{
336336
// Format defaults to the original mime type
337337
$mimeType = $mimeType ?: $this->mimeType;
@@ -473,7 +473,7 @@ public function generate(string $mimeType = null, array|int $options = 100): arr
473473
*
474474
* @throws Exception
475475
*/
476-
public function toDataUri(string $mimeType = null, array|int $options = 100): string
476+
public function toDataUri(string|null $mimeType = null, array|int $options = 100): string
477477
{
478478
$image = $this->generate($mimeType, $options);
479479

@@ -490,7 +490,7 @@ public function toDataUri(string $mimeType = null, array|int $options = 100): st
490490
*
491491
* @throws Exception
492492
*/
493-
public function toDownload(string $filename, string $mimeType = null, array|int $options = 100): static
493+
public function toDownload(string $filename, string|null $mimeType = null, array|int $options = 100): static
494494
{
495495
$image = $this->generate($mimeType, $options);
496496

@@ -517,7 +517,7 @@ public function toDownload(string $filename, string $mimeType = null, array|int
517517
*
518518
* @throws Exception Thrown if failed write to file.
519519
*/
520-
public function toFile(string $file, string $mimeType = null, array|int $options = 100): static
520+
public function toFile(string $file, string|null $mimeType = null, array|int $options = 100): static
521521
{
522522
$image = $this->generate($mimeType, $options);
523523

@@ -538,7 +538,7 @@ public function toFile(string $file, string $mimeType = null, array|int $options
538538
*
539539
* @throws Exception
540540
*/
541-
public function toScreen(string $mimeType = null, array|int $options = 100): static
541+
public function toScreen(string|null $mimeType = null, array|int $options = 100): static
542542
{
543543
$image = $this->generate($mimeType, $options);
544544

@@ -557,7 +557,7 @@ public function toScreen(string $mimeType = null, array|int $options = 100): sta
557557
*
558558
* @throws Exception
559559
*/
560-
public function toString(string $mimeType = null, array|int $options = 100): string
560+
public function toString(string|null $mimeType = null, array|int $options = 100): string
561561
{
562562
return $this->generate($mimeType, $options)['data'];
563563
}
@@ -975,7 +975,7 @@ public function overlay(string|SimpleImage $overlay, string $anchor = 'center',
975975
* @param int|null $height The new image height.
976976
* @return SimpleImage
977977
*/
978-
public function resize(int $width = null, int $height = null): static
978+
public function resize(int|null $width = null, int|null $height = null): static
979979
{
980980
// No dimensions specified
981981
if (! $width && ! $height) {
@@ -1027,7 +1027,7 @@ public function resize(int $width = null, int $height = null): static
10271027
* @param int|null $res_y The vertical resolution in DPI
10281028
* @return SimpleImage
10291029
*/
1030-
public function resolution(int $res_x, int $res_y = null): static
1030+
public function resolution(int $res_x, int|null $res_y = null): static
10311031
{
10321032
if (is_null($res_y)) {
10331033
imageresolution($this->image, $res_x);
@@ -1087,7 +1087,7 @@ public function rotate(int $angle, string|array $backgroundColor = 'transparent'
10871087
*
10881088
* @throws Exception
10891089
*/
1090-
public function text(string $text, array $options, array &$boundary = null): static
1090+
public function text(string $text, array $options, array|null &$boundary = null): static
10911091
{
10921092
// Check for freetype support
10931093
if (! function_exists('imagettftext')) {
@@ -2196,7 +2196,7 @@ public static function darkenColor(string|array $color, int $amount): array
21962196
*
21972197
* @throws Exception Thrown if library \League\ColorExtractor is missing.
21982198
*/
2199-
public function extractColors(int $count = 5, string|array $backgroundColor = null): array
2199+
public function extractColors(int $count = 5, string|array|null $backgroundColor = null): array
22002200
{
22012201
// Check for required library
22022202
if (! class_exists('\\'.ColorExtractor::class)) {

0 commit comments

Comments
 (0)