Skip to content

Commit cea4206

Browse files
authored
Change the implicit nullable type declaration to a nullable type declaration for PHP 8.4 (#525)
https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated#change
1 parent 30745de commit cea4206

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/HasTags.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function setTagsAttribute(string | array | ArrayAccess | Tag $tags)
8989
public function scopeWithAllTags(
9090
Builder $query,
9191
string | array | ArrayAccess | Tag $tags,
92-
string $type = null,
92+
?string $type = null,
9393
): Builder {
9494
$tags = static::convertToTags($tags, $type);
9595

@@ -105,7 +105,7 @@ public function scopeWithAllTags(
105105
public function scopeWithAnyTags(
106106
Builder $query,
107107
string | array | ArrayAccess | Tag $tags,
108-
string $type = null,
108+
?string $type = null,
109109
): Builder {
110110
$tags = static::convertToTags($tags, $type);
111111

@@ -120,7 +120,7 @@ public function scopeWithAnyTags(
120120
public function scopeWithoutTags(
121121
Builder $query,
122122
string | array | ArrayAccess | Tag $tags,
123-
string $type = null
123+
?string $type = null
124124
): Builder {
125125
$tags = static::convertToTags($tags, $type);
126126

@@ -159,12 +159,12 @@ public function scopeWithAnyTagsOfAnyType(Builder $query, $tags): Builder
159159
);
160160
}
161161

162-
public function tagsWithType(string $type = null): Collection
162+
public function tagsWithType(?string $type = null): Collection
163163
{
164164
return $this->tags->filter(fn (Tag $tag) => $tag->type === $type);
165165
}
166166

167-
public function attachTags(array | ArrayAccess | Tag $tags, string $type = null): static
167+
public function attachTags(array | ArrayAccess | Tag $tags, ?string $type = null): static
168168
{
169169
$className = static::getTagClassName();
170170

@@ -300,7 +300,7 @@ protected function syncTagIds($ids, string | null $type = null, $detaching = tru
300300
}
301301
}
302302

303-
public function hasTag($tag, string $type = null): bool
303+
public function hasTag($tag, ?string $type = null): bool
304304
{
305305
return $this->tags
306306
->when($type !== null, fn ($query) => $query->where('type', $type))

0 commit comments

Comments
 (0)