Default implementation for the 'headers' and 'trailers' message properties #3

Closed
opened 2026-04-26 09:27:12 +02:00 by c.fahner · 1 comment
Owner

Currently the Message interface has a type requirement of ArrayAccess&Countable&Traversable for its $headers and $trailers properties. Requiring each library user to create a custom class for these often-used properties is a lot of unnecessary work and may introduce errors and inconsistencies between implementations (since the ArrayAccess implementation has some atypical documented behavior requirements).

This issue introduces a builder-like FieldSet class to improve consistency in behavior across implementations. This type is directly accepted by the Message::$headers and Message::$trailers properties.

Currently the `Message` interface has a type requirement of `ArrayAccess&Countable&Traversable` for its `$headers` and `$trailers` properties. Requiring each library user to create a custom class for these often-used properties is a lot of unnecessary work and may introduce errors and inconsistencies between implementations (since the `ArrayAccess` implementation has some atypical documented behavior requirements). This issue introduces a builder-like `FieldSet` class to improve consistency in behavior across implementations. This type is directly accepted by the `Message::$headers` and `Message::$trailers` properties.
c.fahner added this to the v0.2 milestone 2026-04-26 09:27:12 +02:00
c.fahner stopped working 2026-04-26 19:48:59 +02:00
33 minutes 31 seconds
c.fahner stopped working 2026-04-27 09:50:17 +02:00
27 minutes 20 seconds
c.fahner stopped working 2026-04-27 11:55:34 +02:00
1 hour 49 minutes
Author
Owner

Changed the $headers and $trailers properties of Message to simply require an iterable<Field>. Requiring a complex type like ArrayAccess&Countable&Traversable gives these properties too many responsibilities.

The properties can still be implemented as an ArrayAccess|array for optimization purposes.

Changed the `$headers` and `$trailers` properties of `Message` to simply require an `iterable<Field>`. Requiring a complex type like `ArrayAccess&Countable&Traversable` gives these properties too many responsibilities. The properties can still be implemented as an `ArrayAccess|array` for optimization purposes.
c.fahner stopped working 2026-04-27 13:28:24 +02:00
35 minutes 42 seconds
c.fahner referenced this issue from a commit 2026-04-27 16:52:58 +02:00
c.fahner stopped working 2026-04-27 16:55:36 +02:00
1 hour 12 minutes
c.fahner added spent time 2026-04-29 16:11:31 +02:00
5 minutes
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Total time spent: 4 hours 44 minutes
c.fahner
4 hours 44 minutes
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
slendium/http#3
No description provided.