@@ -195,9 +195,8 @@ public function value(): Token|ByteSequence|DateTimeImmutable|string|int|float|b
195195 public function withValue (mixed $ value ): static
196196 {
197197 return match (true ) {
198- $ value instanceof ByteSequence && $ this ->value instanceof ByteSequence && $ value ->encoded () === $ this ->value ->encoded (),
199- $ value instanceof Token && $ this ->value instanceof Token && $ value ->value === $ this ->value ->value ,
200- $ value instanceof DateTimeInterface && $ this ->value instanceof DateTimeInterface && $ value == $ this ->value ,
198+ ($ this ->value instanceof ByteSequence || $ this ->value instanceof Token) && $ this ->value ->equals ($ value ),
199+ $ this ->value instanceof DateTimeInterface && $ value instanceof DateTimeInterface && $ value == $ this ->value ,
201200 $ value instanceof Stringable && $ value ->__toString () === $ this ->value ,
202201 $ value === $ this ->value => $ this ,
203202 default => self ::from ($ value , $ this ->parameters ),
@@ -249,7 +248,7 @@ public function toHttpValue(): string
249248 return match (true ) {
250249 is_string ($ this ->value ) => '" ' .preg_replace ('/([" \\\])/ ' , '\\\$1 ' , $ this ->value ).'" ' ,
251250 is_int ($ this ->value ) => (string ) $ this ->value ,
252- is_float ($ this ->value ) => $ this -> serializeDecimal ($ this ->value ),
251+ is_float ($ this ->value ) => self :: serializeDecimal ($ this ->value ),
253252 is_bool ($ this ->value ) => '? ' .($ this ->value ? '1 ' : '0 ' ),
254253 $ this ->value instanceof Token => $ this ->value ->value ,
255254 $ this ->value instanceof DateTimeImmutable => '@ ' .$ this ->value ->getTimestamp (),
@@ -262,7 +261,7 @@ public function toHttpValue(): string
262261 *
263262 * @see https://www.rfc-editor.org/rfc/rfc8941.html#section-4.1.5
264263 */
265- private function serializeDecimal (float $ value ): string
264+ private static function serializeDecimal (float $ value ): string
266265 {
267266 /** @var string $result */
268267 $ result = json_encode (round ($ value , 3 , PHP_ROUND_HALF_EVEN ));
0 commit comments