Skip to content

Commit

Permalink
Explicitly mark parameters as nullable (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
distantnative authored Nov 22, 2024
1 parent dfbe53c commit ec6d502
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/claviska/SimpleImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public function fromString(string $string): SimpleImage|static
*
* @throws Exception Thrown when WEBP support is not enabled or unsupported format.
*/
public function generate(string $mimeType = null, array|int $options = 100): array
public function generate(string|null $mimeType = null, array|int $options = 100): array
{
// Format defaults to the original mime type
$mimeType = $mimeType ?: $this->mimeType;
Expand Down Expand Up @@ -473,7 +473,7 @@ public function generate(string $mimeType = null, array|int $options = 100): arr
*
* @throws Exception
*/
public function toDataUri(string $mimeType = null, array|int $options = 100): string
public function toDataUri(string|null $mimeType = null, array|int $options = 100): string
{
$image = $this->generate($mimeType, $options);

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

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

Expand All @@ -538,7 +538,7 @@ public function toFile(string $file, string $mimeType = null, array|int $options
*
* @throws Exception
*/
public function toScreen(string $mimeType = null, array|int $options = 100): static
public function toScreen(string|null $mimeType = null, array|int $options = 100): static
{
$image = $this->generate($mimeType, $options);

Expand All @@ -557,7 +557,7 @@ public function toScreen(string $mimeType = null, array|int $options = 100): sta
*
* @throws Exception
*/
public function toString(string $mimeType = null, array|int $options = 100): string
public function toString(string|null $mimeType = null, array|int $options = 100): string
{
return $this->generate($mimeType, $options)['data'];
}
Expand Down Expand Up @@ -975,7 +975,7 @@ public function overlay(string|SimpleImage $overlay, string $anchor = 'center',
* @param int|null $height The new image height.
* @return SimpleImage
*/
public function resize(int $width = null, int $height = null): static
public function resize(int|null $width = null, int|null $height = null): static
{
// No dimensions specified
if (! $width && ! $height) {
Expand Down Expand Up @@ -1027,7 +1027,7 @@ public function resize(int $width = null, int $height = null): static
* @param int|null $res_y The vertical resolution in DPI
* @return SimpleImage
*/
public function resolution(int $res_x, int $res_y = null): static
public function resolution(int $res_x, int|null $res_y = null): static
{
if (is_null($res_y)) {
imageresolution($this->image, $res_x);
Expand Down Expand Up @@ -1087,7 +1087,7 @@ public function rotate(int $angle, string|array $backgroundColor = 'transparent'
*
* @throws Exception
*/
public function text(string $text, array $options, array &$boundary = null): static
public function text(string $text, array $options, array|null &$boundary = null): static
{
// Check for freetype support
if (! function_exists('imagettftext')) {
Expand Down Expand Up @@ -2196,7 +2196,7 @@ public static function darkenColor(string|array $color, int $amount): array
*
* @throws Exception Thrown if library \League\ColorExtractor is missing.
*/
public function extractColors(int $count = 5, string|array $backgroundColor = null): array
public function extractColors(int $count = 5, string|array|null $backgroundColor = null): array
{
// Check for required library
if (! class_exists('\\'.ColorExtractor::class)) {
Expand Down

0 comments on commit ec6d502

Please sign in to comment.