@@ -31,69 +31,39 @@ public function reset(): void
3131 $ this ->headers = [];
3232 }
3333
34- /**
35- * @param int $code
36- *
37- * @return static
38- */
39- public function setCode (int $ code )
34+ public function setCode (int $ code ): Response
4035 {
4136 $ this ->code = $ code ;
4237
4338 return $ this ;
4439 }
4540
46- /**
47- * @return int
48- */
4941 public function getCode (): int
5042 {
5143 return $ this ->code ;
5244 }
5345
54- /**
55- * @param string $name
56- * @param string $value
57- *
58- * @return static
59- */
60- public function setHeader (string $ name , string $ value )
46+ public function setHeader (string $ name , string $ value ): Response
6147 {
6248 $ this ->headers [$ name ] = $ value ;
6349
6450 return $ this ;
6551 }
6652
67- /**
68- * @param string $name
69- * @param string $value
70- *
71- * @return static
72- */
73- public function addHeader (string $ name , string $ value )
53+ public function addHeader (string $ name , string $ value ): Response
7454 {
7555 $ this ->headers [$ name ] = $ value ;
7656
7757 return $ this ;
7858 }
7959
80- /**
81- * @param string $type
82- * @param string $charset
83- *
84- * @return static
85- */
86- public function setContentType (string $ type , string $ charset = null )
60+ public function setContentType (string $ type , ?string $ charset = null ): Response
8761 {
8862 $ this ->setHeader ('Content-Type ' , $ type .($ charset ? '; charset= ' .$ charset : '' ));
8963
9064 return $ this ;
9165 }
9266
93- /**
94- * @param string $url
95- * @param int $code
96- */
9767 public function redirect (string $ url , int $ code = self ::S302_FOUND ): void
9868 {
9969 $ this ->setCode ($ code );
@@ -102,10 +72,8 @@ public function redirect(string $url, int $code = self::S302_FOUND): void
10272
10373 /**
10474 * @param string|int|DateTime $time
105- *
106- * @return static
10775 */
108- public function setExpiration ($ time )
76+ public function setExpiration ($ time ): Response
10977 {
11078 if (!$ time ) {
11179 $ this ->setHeader ('Cache-Control ' , 's-maxage=0, max-age=0, must-revalidate ' );
@@ -121,55 +89,30 @@ public function setExpiration($time)
12189 return $ this ;
12290 }
12391
124- /**
125- * @return bool
126- */
12792 public function isSent (): bool
12893 {
12994 return false ;
13095 }
13196
132- /**
133- * @param string $name
134- *
135- * @return mixed
136- */
13797 public function getHeader (string $ name ): ?string
13898 {
13999 return $ this ->headers [$ name ] ?? null ;
140100 }
141101
142- /**
143- * @return array
144- */
145102 public function getHeaders (): array
146103 {
147104 return $ this ->headers ;
148105 }
149106
150107 /**
151- * @param string $name
152- * @param string $value
153108 * @param string|int|DateTime $time
154- * @param string $path
155- * @param string $domain
156- * @param bool $secure
157- * @param bool $httpOnly
158- *
159- * @return self
160109 */
161- public function setCookie (string $ name , string $ value , $ time , string $ path = null , string $ domain = null , bool $ secure = null , bool $ httpOnly = null , string $ sameSite = null )
110+ public function setCookie (string $ name , string $ value , $ time , ? string $ path = null , ? string $ domain = null , ? bool $ secure = null , ? bool $ httpOnly = null , ? string $ sameSite = null ): Response
162111 {
163112 return $ this ;
164113 }
165114
166- /**
167- * @param string $name
168- * @param string $path
169- * @param string $domain
170- * @param bool $secure
171- */
172- public function deleteCookie (string $ name , string $ path = null , string $ domain = null , bool $ secure = null ): void
115+ public function deleteCookie (string $ name , ?string $ path = null , ?string $ domain = null , ?bool $ secure = null ): void
173116 {
174117 }
175118}
0 commit comments