@@ -423,13 +423,13 @@ public function hasHeader($name)
423423 *
424424 * @param string $name Case-insensitive header field name to add.
425425 * @param string|string[] $value Header value(s).
426- * @return ServerRequest
426+ * @return static
427427 * @throws InvalidArgumentException for invalid header names or values.
428428 */
429429 public function withAddedHeader ($ name , $ value )
430430 {
431431 $ serverRequest = $ this ->serverRequest ->withAddedHeader ($ name , $ value );
432- return new ServerRequest ($ serverRequest );
432+ return new static ($ serverRequest );
433433 }
434434
435435 /**
@@ -445,12 +445,12 @@ public function withAddedHeader($name, $value)
445445 * @see getAttributes()
446446 * @param string $name The attribute name.
447447 * @param mixed $value The value of the attribute.
448- * @return ServerRequest
448+ * @return static
449449 */
450450 public function withAttribute ($ name , $ value )
451451 {
452452 $ serverRequest = $ this ->serverRequest ->withAttribute ($ name , $ value );
453- return new ServerRequest ($ serverRequest );
453+ return new static ($ serverRequest );
454454 }
455455
456456 /**
@@ -466,7 +466,7 @@ public function withAttribute($name, $value)
466466 * updated attributes.
467467 *
468468 * @param array $attributes New attributes
469- * @return ServerRequest
469+ * @return static
470470 */
471471 public function withAttributes (array $ attributes )
472472 {
@@ -476,7 +476,7 @@ public function withAttributes(array $attributes)
476476 $ serverRequest = $ serverRequest ->withAttribute ($ attribute , $ value );
477477 }
478478
479- return new ServerRequest ($ serverRequest );
479+ return new static ($ serverRequest );
480480 }
481481
482482 /**
@@ -491,12 +491,12 @@ public function withAttributes(array $attributes)
491491 *
492492 * @see getAttributes()
493493 * @param string $name The attribute name.
494- * @return ServerRequest
494+ * @return static
495495 */
496496 public function withoutAttribute ($ name )
497497 {
498498 $ serverRequest = $ this ->serverRequest ->withoutAttribute ($ name );
499- return new ServerRequest ($ serverRequest );
499+ return new static ($ serverRequest );
500500 }
501501
502502 /**
@@ -509,13 +509,13 @@ public function withoutAttribute($name)
509509 * new body stream.
510510 *
511511 * @param StreamInterface $body Body.
512- * @return ServerRequest
512+ * @return static
513513 * @throws InvalidArgumentException When the body is not valid.
514514 */
515515 public function withBody (StreamInterface $ body )
516516 {
517517 $ serverRequest = $ this ->serverRequest ->withBody ($ body );
518- return new ServerRequest ($ serverRequest );
518+ return new static ($ serverRequest );
519519 }
520520
521521 /**
@@ -533,12 +533,12 @@ public function withBody(StreamInterface $body)
533533 * updated cookie values.
534534 *
535535 * @param array $cookies Array of key/value pairs representing cookies.
536- * @return ServerRequest
536+ * @return static
537537 */
538538 public function withCookieParams (array $ cookies )
539539 {
540540 $ serverRequest = $ this ->serverRequest ->withCookieParams ($ cookies );
541- return new ServerRequest ($ serverRequest );
541+ return new static ($ serverRequest );
542542 }
543543
544544 /**
@@ -553,13 +553,13 @@ public function withCookieParams(array $cookies)
553553 *
554554 * @param string $name Case-insensitive header field name.
555555 * @param string|string[] $value Header value(s).
556- * @return ServerRequest
556+ * @return static
557557 * @throws InvalidArgumentException for invalid header names or values.
558558 */
559559 public function withHeader ($ name , $ value )
560560 {
561561 $ serverRequest = $ this ->serverRequest ->withHeader ($ name , $ value );
562- return new ServerRequest ($ serverRequest );
562+ return new static ($ serverRequest );
563563 }
564564
565565 /**
@@ -572,12 +572,12 @@ public function withHeader($name, $value)
572572 * the named header.
573573 *
574574 * @param string $name Case-insensitive header field name to remove.
575- * @return ServerRequest
575+ * @return static
576576 */
577577 public function withoutHeader ($ name )
578578 {
579579 $ serverRequest = $ this ->serverRequest ->withoutHeader ($ name );
580- return new ServerRequest ($ serverRequest );
580+ return new static ($ serverRequest );
581581 }
582582
583583 /**
@@ -592,13 +592,13 @@ public function withoutHeader($name)
592592 * changed request method.
593593 *
594594 * @param string $method Case-sensitive method.
595- * @return ServerRequest
595+ * @return static
596596 * @throws InvalidArgumentException for invalid HTTP methods.
597597 */
598598 public function withMethod ($ method )
599599 {
600600 $ serverRequest = $ this ->serverRequest ->withMethod ($ method );
601- return new ServerRequest ($ serverRequest );
601+ return new static ($ serverRequest );
602602 }
603603
604604 /**
@@ -625,14 +625,14 @@ public function withMethod($method)
625625 *
626626 * @param null|array|object $data The deserialized body data. This will
627627 * typically be in an array or object.
628- * @return ServerRequest
628+ * @return static
629629 * @throws InvalidArgumentException if an unsupported argument type is
630630 * provided.
631631 */
632632 public function withParsedBody ($ data )
633633 {
634634 $ serverRequest = $ this ->serverRequest ->withParsedBody ($ data );
635- return new ServerRequest ($ serverRequest );
635+ return new static ($ serverRequest );
636636 }
637637
638638 /**
@@ -646,12 +646,12 @@ public function withParsedBody($data)
646646 * new protocol version.
647647 *
648648 * @param string $version HTTP protocol version
649- * @return ServerRequest
649+ * @return static
650650 */
651651 public function withProtocolVersion ($ version )
652652 {
653653 $ serverRequest = $ this ->serverRequest ->withProtocolVersion ($ version );
654- return new ServerRequest ($ serverRequest );
654+ return new static ($ serverRequest );
655655 }
656656
657657 /**
@@ -674,12 +674,12 @@ public function withProtocolVersion($version)
674674 *
675675 * @param array $query Array of query string arguments, typically from
676676 * $_GET.
677- * @return ServerRequest
677+ * @return static
678678 */
679679 public function withQueryParams (array $ query )
680680 {
681681 $ serverRequest = $ this ->serverRequest ->withQueryParams ($ query );
682- return new ServerRequest ($ serverRequest );
682+ return new static ($ serverRequest );
683683 }
684684
685685 /**
@@ -697,12 +697,12 @@ public function withQueryParams(array $query)
697697 * @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various
698698 * request-target forms allowed in request messages)
699699 * @param mixed $requestTarget
700- * @return ServerRequest
700+ * @return static
701701 */
702702 public function withRequestTarget ($ requestTarget )
703703 {
704704 $ serverRequest = $ this ->serverRequest ->withRequestTarget ($ requestTarget );
705- return new ServerRequest ($ serverRequest );
705+ return new static ($ serverRequest );
706706 }
707707
708708 /**
@@ -713,13 +713,13 @@ public function withRequestTarget($requestTarget)
713713 * updated body parameters.
714714 *
715715 * @param array $uploadedFiles An array tree of UploadedFileInterface instances.
716- * @return ServerRequest
716+ * @return static
717717 * @throws InvalidArgumentException if an invalid structure is provided.
718718 */
719719 public function withUploadedFiles (array $ uploadedFiles )
720720 {
721721 $ serverRequest = $ this ->serverRequest ->withUploadedFiles ($ uploadedFiles );
722- return new ServerRequest ($ serverRequest );
722+ return new static ($ serverRequest );
723723 }
724724
725725 /**
@@ -750,12 +750,12 @@ public function withUploadedFiles(array $uploadedFiles)
750750 * @link http://tools.ietf.org/html/rfc3986#section-4.3
751751 * @param UriInterface $uri New request URI to use.
752752 * @param bool $preserveHost Preserve the original state of the Host header.
753- * @return ServerRequest
753+ * @return static
754754 */
755755 public function withUri (UriInterface $ uri , $ preserveHost = false )
756756 {
757757 $ serverRequest = $ this ->serverRequest ->withUri ($ uri , $ preserveHost );
758- return new ServerRequest ($ serverRequest );
758+ return new static ($ serverRequest );
759759 }
760760
761761 /**
@@ -986,9 +986,9 @@ public function getServerParam($key, $default = null)
986986 *
987987 * @param string $mediaType A HTTP media type (excluding content-type params).
988988 * @param callable $callable A callable that returns parsed contents for media type.
989- * @return self
989+ * @return static
990990 */
991- public function registerMediaTypeParser ($ mediaType , callable $ callable )
991+ public function registerMediaTypeParser ($ mediaType , callable $ callable ): ServerRequestInterface
992992 {
993993 if ($ callable instanceof Closure) {
994994 $ callable = $ callable ->bindTo ($ this );
0 commit comments