1111
1212namespace Symfony \Bridge \PsrHttpMessage \Tests \Fixtures ;
1313
14+ use Psr \Http \Message \RequestInterface ;
1415use Psr \Http \Message \ServerRequestInterface ;
1516use Psr \Http \Message \StreamInterface ;
1617use Psr \Http \Message \UriInterface ;
@@ -34,6 +35,10 @@ public function __construct($version = '1.1', array $headers = [], StreamInterfa
3435 {
3536 parent ::__construct ($ version , $ headers , $ body );
3637
38+ if (!($ uri instanceof UriInterface)) {
39+ $ uri = new Uri ((string ) $ uri );
40+ }
41+
3742 $ this ->requestTarget = $ requestTarget ;
3843 $ this ->method = $ method ;
3944 $ this ->uri = $ uri ;
@@ -52,10 +57,8 @@ public function getRequestTarget(): string
5257
5358 /**
5459 * {@inheritdoc}
55- *
56- * @return static
5760 */
58- public function withRequestTarget ($ requestTarget )
61+ public function withRequestTarget ($ requestTarget ): RequestInterface
5962 {
6063 throw new \BadMethodCallException ('Not implemented. ' );
6164 }
@@ -67,20 +70,16 @@ public function getMethod(): string
6770
6871 /**
6972 * {@inheritdoc}
70- *
71- * @return static
7273 */
73- public function withMethod ($ method )
74+ public function withMethod ($ method ): RequestInterface
7475 {
7576 throw new \BadMethodCallException ('Not implemented. ' );
7677 }
7778
7879 /**
7980 * {@inheritdoc}
80- *
81- * @return UriInterface
8281 */
83- public function getUri ()
82+ public function getUri (): UriInterface
8483 {
8584 return $ this ->uri ;
8685 }
@@ -90,7 +89,7 @@ public function getUri()
9089 *
9190 * @return static
9291 */
93- public function withUri (UriInterface $ uri , $ preserveHost = false )
92+ public function withUri (UriInterface $ uri , $ preserveHost = false ): RequestInterface
9493 {
9594 throw new \BadMethodCallException ('Not implemented. ' );
9695 }
@@ -110,7 +109,7 @@ public function getCookieParams(): array
110109 *
111110 * @return static
112111 */
113- public function withCookieParams (array $ cookies )
112+ public function withCookieParams (array $ cookies ): ServerRequestInterface
114113 {
115114 throw new \BadMethodCallException ('Not implemented. ' );
116115 }
@@ -125,7 +124,7 @@ public function getQueryParams(): array
125124 *
126125 * @return static
127126 */
128- public function withQueryParams (array $ query )
127+ public function withQueryParams (array $ query ): ServerRequestInterface
129128 {
130129 throw new \BadMethodCallException ('Not implemented. ' );
131130 }
@@ -140,7 +139,7 @@ public function getUploadedFiles(): array
140139 *
141140 * @return static
142141 */
143- public function withUploadedFiles (array $ uploadedFiles )
142+ public function withUploadedFiles (array $ uploadedFiles ): ServerRequestInterface
144143 {
145144 throw new \BadMethodCallException ('Not implemented. ' );
146145 }
@@ -160,7 +159,7 @@ public function getParsedBody()
160159 *
161160 * @return static
162161 */
163- public function withParsedBody ($ data )
162+ public function withParsedBody ($ data ): ServerRequestInterface
164163 {
165164 throw new \BadMethodCallException ('Not implemented. ' );
166165 }
@@ -185,7 +184,7 @@ public function getAttribute($name, $default = null)
185184 *
186185 * @return static
187186 */
188- public function withAttribute ($ name , $ value )
187+ public function withAttribute ($ name , $ value ): ServerRequestInterface
189188 {
190189 throw new \BadMethodCallException ('Not implemented. ' );
191190 }
@@ -195,7 +194,7 @@ public function withAttribute($name, $value)
195194 *
196195 * @return static
197196 */
198- public function withoutAttribute ($ name )
197+ public function withoutAttribute ($ name ): ServerRequestInterface
199198 {
200199 throw new \BadMethodCallException ('Not implemented. ' );
201200 }
0 commit comments