1616 * @see https://www.rfc-editor.org/rfc/rfc8941.html#section-3.3
1717 *
1818 * @phpstan-import-type SfItem from StructuredField
19+ * @phpstan-import-type SfType from StructuredField
1920 * @phpstan-import-type SfItemInput from StructuredField
21+ * @phpstan-import-type SfTypeInput from StructuredField
2022 * @phpstan-type SfItemPair array{0:ByteSequence|Token|DisplayString|DisplayString|DateTimeInterface|string|int|float|bool, 1:MemberOrderedMap<string, SfItem>|iterable<array{0:string, 1:SfItemInput}>}
2123 */
2224final class Item implements ParameterAccess, ValueAccess
@@ -58,8 +60,8 @@ public static function fromAssociative(ByteSequence|Token|DisplayString|DateTime
5860
5961 /**
6062 * @param array{
61- * 0:ByteSequence|Token|DisplayString|DisplayString|DateTimeInterface|string|int|float|bool ,
62- * 1:MemberOrderedMap<string, SfItem>|iterable<array{0:string, 1:SfItemInput}>
63+ * 0: SfType ,
64+ * 1: MemberOrderedMap<string, SfItem>|iterable<array{0:string, 1:SfItemInput}>
6365 * } $pair
6466 *
6567 * @throws SyntaxError If the pair or its content is not valid.
@@ -76,10 +78,16 @@ public static function fromPair(array $pair): self
7678 /**
7779 * Returns a new bare instance from value.
7880 *
81+ * @param SfTypeInput|array{0:SfType, 1:MemberOrderedMap<string, SfItem>|iterable<array{0:string, 1:SfItemInput}>} $value
82+ *
7983 * @throws SyntaxError If the value is not valid.
8084 */
81- public static function new (ByteSequence | Token | DisplayString | DateTimeInterface | string | int | float | bool $ value ): self
85+ public static function new (mixed $ value ): self
8286 {
87+ if (is_array ($ value )) {
88+ return self ::fromPair ($ value );
89+ }
90+
8391 return self ::fromValue (new Value ($ value ));
8492 }
8593
0 commit comments