1414 * Class to manage the headers of translations.
1515 *
1616 * @phpstan-consistent-constructor
17+ *
18+ * @phpstan-type HeadersType array<string, string>
19+ *
20+ * @implements IteratorAggregate<string, string>
1721 */
1822class Headers implements JsonSerializable, Countable, IteratorAggregate
1923{
2024 public const HEADER_LANGUAGE = 'Language ' ;
2125 public const HEADER_PLURAL = 'Plural-Forms ' ;
2226 public const HEADER_DOMAIN = 'X-Domain ' ;
2327
28+ /**
29+ * @var HeadersType
30+ */
2431 protected $ headers = [];
2532
33+ /**
34+ * @param array{headers: HeadersType} $state
35+ */
2636 public static function __set_state (array $ state ): Headers
2737 {
2838 return new static ($ state ['headers ' ]);
2939 }
3040
41+ /**
42+ * @param HeadersType $headers
43+ */
3144 public function __construct (array $ headers = [])
3245 {
3346 $ this ->headers = $ headers ;
@@ -115,7 +128,7 @@ public function setPluralForm(int $count, string $rule): self
115128 /**
116129 * Returns the parsed plural definition.
117130 *
118- * @return array|null [count, rule]
131+ * @return array{int, string} |null [count, rule]
119132 */
120133 public function getPluralForm (): ?array
121134 {
@@ -130,6 +143,9 @@ public function getPluralForm(): ?array
130143 return null ;
131144 }
132145
146+ /**
147+ * @return HeadersType
148+ */
133149 public function toArray (): array
134150 {
135151 return $ this ->headers ;
0 commit comments