22
33namespace Contributte \Codeception \Http ;
44
5+ use DateTimeInterface ;
56use Nette \Http \Helpers ;
67use Nette \Http \IResponse ;
78use Nette \Utils \DateTime ;
@@ -30,63 +31,51 @@ public function getCode(): int
3031 }
3132
3233 /**
33- * @param int $code
34- * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
34+ * @return static
3535 */
36- public function setCode ($ code): self
36+ public function setCode (int $ code, ? string $ reason = null )
3737 {
3838 $ this ->code = $ code ;
3939 return $ this ;
4040 }
4141
4242 /**
43- * @param string $name
44- * @param string $value
45- * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
43+ * @return static
4644 */
47- public function setHeader ($ name , $ value ): self
45+ public function setHeader (string $ name , string $ value )
4846 {
4947 $ this ->headers [$ name ] = $ value ;
5048 return $ this ;
5149 }
5250
5351 /**
54- * @param string $name
55- * @param string $value
56- * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
52+ * @return static
5753 */
58- public function addHeader ($ name , $ value ): self
54+ public function addHeader (string $ name , string $ value )
5955 {
6056 $ this ->headers [$ name ] = $ value ;
6157 return $ this ;
6258 }
6359
6460 /**
65- * @param string $type
66- * @param string|null $charset
67- * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
61+ * @return static
6862 */
69- public function setContentType ($ type , $ charset = null ): self
63+ public function setContentType (string $ type , ? string $ charset = null )
7064 {
7165 $ this ->setHeader ('Content-Type ' , $ type . ($ charset !== null ? '; charset= ' . $ charset : '' ));
7266 return $ this ;
7367 }
7468
75- /**
76- * @param string $url
77- * @param int $code
78- * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
79- */
80- public function redirect ($ url , $ code = self ::S302_FOUND ): void
69+ public function redirect (string $ url , int $ code = self ::S302_FOUND ): void
8170 {
8271 $ this ->setCode ($ code );
8372 $ this ->setHeader ('Location ' , $ url );
8473 }
8574
8675 /**
87- * @param string|int|DateTime $time
76+ * @return static
8877 */
89- public function setExpiration ($ time ): self
78+ public function setExpiration (? string $ time )
9079 {
9180 if (!$ time ) {
9281 $ this ->setHeader ('Cache-Control ' , 's-maxage=0, max-age=0, must-revalidate ' );
@@ -107,14 +96,9 @@ public function isSent(): bool
10796 return false ;
10897 }
10998
110- /**
111- * @param string $name
112- * @param string|null $default
113- * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
114- */
115- public function getHeader ($ name , $ default = null ): ?string
99+ public function getHeader (string $ name ): ?string
116100 {
117- return $ this ->headers [$ name ] ?? $ default ;
101+ return $ this ->headers [$ name ] ?? null ;
118102 }
119103
120104 /**
@@ -126,29 +110,15 @@ public function getHeaders(): array
126110 }
127111
128112 /**
129- * @param string $name
130- * @param string $value
131- * @param string|int|DateTime $time
132- * @param string|null $path
133- * @param string|null $domain
134- * @param bool|null $secure
135- * @param bool|null $httpOnly
136- * @param string|null $sameSite
137- * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
113+ * @param string|int|DateTimeInterface $time
114+ * @return static
138115 */
139- public function setCookie ($ name , $ value , $ time , $ path = null , $ domain = null , $ secure = null , $ httpOnly = null , $ sameSite = null ): self
116+ public function setCookie (string $ name , string $ value , $ time , ? string $ path = null , ? string $ domain = null , ? bool $ secure = null , ? bool $ httpOnly = null , ? string $ sameSite = null )
140117 {
141118 return $ this ;
142119 }
143120
144- /**
145- * @param string $name
146- * @param string|null $path
147- * @param string|null $domain
148- * @param bool|null $secure
149- * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
150- */
151- public function deleteCookie ($ name , $ path = null , $ domain = null , $ secure = null ): void
121+ public function deleteCookie (string $ name , ?string $ path = null , ?string $ domain = null , ?bool $ secure = null ): void
152122 {
153123 }
154124
0 commit comments