Skip to content

Commit d5f6bb7

Browse files
Merge pull request #5 from tobimori/patch-1
Fix implicit nullable param (PHP 8.4)
2 parents b4ee273 + 41a7bf0 commit d5f6bb7

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

src/Alias.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Alias
1212

1313
protected ?string $namespace = null;
1414

15-
public function __construct(ReflectionClass $target, string $name = null)
15+
public function __construct(ReflectionClass $target, ?string $name = null)
1616
{
1717
$this->target = $target;
1818
$this->name = $name ??= $target->getShortName();

src/Comment.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static function from(ReflectionFunction|ReflectionMethod $source): static
5050
return static::fromString($comment, $context);
5151
}
5252

53-
public static function fromString(string $comment, Context $context = null): static
53+
public static function fromString(string $comment, ?Context $context = null): static
5454
{
5555
$docBlock = DocBlockFactory::createInstance()->create(
5656
$comment, $context

src/Method.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class Method
4444
public function __construct(
4545
ReflectionFunction|ReflectionMethod $function,
4646
ReflectionClass $target,
47-
string $name = null,
48-
string $alias = null
47+
?string $name = null,
48+
?string $alias = null
4949
) {
5050
$this->function = $function;
5151
$this->target = $target;

src/Methods/BlueprintMethod.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function link(string $type): ?string
5555
return static::$links[$type] ?? null;
5656
}
5757

58-
public function document(string $type, string $blueprint = null): static
58+
public function document(string $type, ?string $blueprint = null): static
5959
{
6060
$comment = $this->comment();
6161

src/Tag.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function __construct(
1313
protected ?string $content = null,
1414
) {}
1515

16-
public static function make(string $name, string $content = null): static
16+
public static function make(string $name, ?string $content = null): static
1717
{
1818
$name = ltrim($name, '@');
1919

@@ -34,7 +34,7 @@ public function getContent(): ?string
3434
return $this->content;
3535
}
3636

37-
public function setContent(string $content = null)
37+
public function setContent(?string $content = null)
3838
{
3939
$this->content = $content;
4040
}

src/Tags.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __set(string $key, mixed $value): void
2323
$this->data[$key] = $value;
2424
}
2525

26-
public function add(string $tag, string $content = null): static
26+
public function add(string $tag, ?string $content = null): static
2727
{
2828
return $this->append(Tag::make($tag, $content));
2929
}

src/Types.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ public function addAliases(array $aliases): void
288288
}
289289
}
290290

291-
public function addBlueprint(ModelWithContent $model, string $name = null): void
291+
public function addBlueprint(ModelWithContent $model, ?string $name = null): void
292292
{
293293
$target = new ReflectionClass($model);
294294

@@ -314,7 +314,7 @@ public function addBlueprintFields(string $blueprint, array $fields, ReflectionC
314314

315315
$method->document($type = $field['type'], $blueprint);
316316

317-
$this->pushMethod($method, function (Method $a, Method $b = null) {
317+
$this->pushMethod($method, function (Method $a, ?Method $b = null) {
318318
if ($a instanceof BlueprintMethod && $b instanceof BlueprintMethod) {
319319
$b->merge($a);
320320
}

0 commit comments

Comments
 (0)