mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-17 17:47:13 +00:00
♻️ revert get default value to string
This commit is contained in:
@@ -66,7 +66,7 @@ final class MethodParameterFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<array, null, int, float, bool, string, object> $defaultValue
|
||||
* @param array<array|null|int|float|bool|string|object> $defaultValue
|
||||
* @return string
|
||||
*/
|
||||
private function formatArray(array $defaultValue): string
|
||||
|
||||
@@ -69,9 +69,12 @@ final class MethodParameter
|
||||
return $this->isVariadic;
|
||||
}
|
||||
|
||||
public function getDefaultValue(): mixed
|
||||
public function getDefaultValue(): ?string
|
||||
{
|
||||
return $this->defaultValue;
|
||||
if (is_array($this->defaultValue)) {
|
||||
return implode(',', $this->defaultValue);
|
||||
}
|
||||
return (string) $this->defaultValue;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
@@ -80,6 +83,6 @@ final class MethodParameter
|
||||
($this->isReference() ? '&' : '') .
|
||||
($this->isVariadic() ? '...' : '') .
|
||||
'$' . $this->getName() .
|
||||
($this->getDefaultValue() !== self::NO_DEFAULT_VALUE ? (new MethodParameterFactory)->format($this->getDefaultValue()) : '');
|
||||
($this->defaultValue !== self::NO_DEFAULT_VALUE ? (new MethodParameterFactory)->format($this->defaultValue) : '');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user