Skip to content

Commit

Permalink
Merge pull request #19 from loco8878/php-84
Browse files Browse the repository at this point in the history
#18 Add missing implicit nullable type
  • Loading branch information
crocodile2u authored Nov 27, 2024
2 parents 7d267ca + e96be4b commit 1c6206f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/OptionSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function enlarge(): ?bool
return $this->firstValue(ProcessingOption::ENLARGE, 'bool');
}

public function withExtend(string $gravityType = null, $gravityX = null, $gravityY = null): self
public function withExtend(?string $gravityType = null, $gravityX = null, $gravityY = null): self
{
if ($gravityType === Gravity::SMART) {
throw new \InvalidArgumentException("extend doesnt support smart gravity");
Expand All @@ -147,7 +147,7 @@ public function extend(): ?array
return $this->get(ProcessingOption::EXTEND);
}

public function withGravity(string $type = null, $x = null, $y = null): self
public function withGravity(?string $type = null, $x = null, $y = null): self
{
$gravity = $this->gravityOptions($type, [], $x, $y);
if (count($gravity) === 0) {
Expand All @@ -171,7 +171,7 @@ public function gravity(): ?array
return $this->get(ProcessingOption::GRAVITY);
}

public function withCrop($w, $h, string $gravityType = null, $gravityX = null, $gravityY = null): self
public function withCrop($w, $h, ?string $gravityType = null, $gravityX = null, $gravityY = null): self
{
$gravity = $this->gravityOptions($gravityType, [], $gravityX, $gravityY);
return $this->set(ProcessingOption::CROP, $w, $h, ...$gravity);
Expand All @@ -182,7 +182,7 @@ public function crop(): ?array
return $this->get(ProcessingOption::CROP);
}

private function gravityOptions(string $type = null, array $defaults, $x = null, $y = null): array
private function gravityOptions(?string $type = null, array $defaults, $x = null, $y = null): array
{
switch ($type) {
case null:
Expand Down Expand Up @@ -428,8 +428,8 @@ public function pixelate(): ?int

public function withUnsharpening(
string $mode = UnsharpeningMode::AUTO,
float $weight = null,
float $dividor = null
?float $weight = null,
?float $dividor = null
): self {
switch ($mode) {
case UnsharpeningMode::AUTO:
Expand Down
4 changes: 2 additions & 2 deletions src/UrlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class UrlBuilder
* @param string $salt
* @throws Exception
*/
public function __construct(string $baseUrl, string $key = null, string $salt = null, $signatureSize = 0)
public function __construct(string $baseUrl, ?string $key = null, ?string $salt = null, $signatureSize = 0)
{
if ($key && $salt) {
$this->key = pack("H*" , $key) ?: $this->throwException("Key expected to be hex-encoded string");
Expand All @@ -55,7 +55,7 @@ public function build(
string $fit = "fit",
string $gravity = "sm",
bool $enlarge = false,
string $extension = null
?string $extension = null
): Url {
return (new Url($this, $imageUrl, $w, $h))
->setFit($fit)
Expand Down

0 comments on commit 1c6206f

Please sign in to comment.