diff --git a/src/Foundation/Message.php b/src/Foundation/Message.php index 7bb3f536..13417047 100644 --- a/src/Foundation/Message.php +++ b/src/Foundation/Message.php @@ -40,10 +40,22 @@ public function __debugInfo() } /** + * @param array|mixed $options + * * @return static */ - public static function make(...$parameters): self + public static function make($options = []): self { - return new static(...$parameters); + if (0 === \func_num_args()) { + return new static($options); + } + + $defaultProperties = (new \ReflectionClass(static::class))->getDefaultProperties(); + $defined = array_unique(array_merge($defaultProperties['defined'] ?? [], $defaultProperties['required'] ?? [])); + if (1 === \count($defined)) { + return new static([reset($defined) => $options]); + } + + return new static($options); } }