Skip to content

Commit f26d445

Browse files
committed
♻️ revert get default value to string
1 parent 2b2242d commit f26d445

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/DocBlock/Tags/Factory/MethodParameterFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private function formatBoolean(bool $defaultValue): string
6666
}
6767

6868
/**
69-
* @param array<array, null, int, float, bool, string, object> $defaultValue
69+
* @param array<array|null|int|float|bool|string|object> $defaultValue
7070
* @return string
7171
*/
7272
private function formatArray(array $defaultValue): string

src/DocBlock/Tags/MethodParameter.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,12 @@ public function isVariadic(): bool
6969
return $this->isVariadic;
7070
}
7171

72-
public function getDefaultValue(): mixed
72+
public function getDefaultValue(): ?string
7373
{
74-
return $this->defaultValue;
74+
if (is_array($this->defaultValue)) {
75+
return implode(',', $this->defaultValue);
76+
}
77+
return (string) $this->defaultValue;
7578
}
7679

7780
public function __toString(): string
@@ -80,6 +83,6 @@ public function __toString(): string
8083
($this->isReference() ? '&' : '') .
8184
($this->isVariadic() ? '...' : '') .
8285
'$' . $this->getName() .
83-
($this->getDefaultValue() !== self::NO_DEFAULT_VALUE ? (new MethodParameterFactory)->format($this->getDefaultValue()) : '');
86+
($this->defaultValue !== self::NO_DEFAULT_VALUE ? (new MethodParameterFactory)->format($this->defaultValue) : '');
8487
}
8588
}

0 commit comments

Comments
 (0)