@@ -986,6 +986,18 @@ public function getPort() : int
986986 return $ this ->port ?? $ _SERVER ['SERVER_PORT ' ];
987987 }
988988
989+ /**
990+ * Make an empty value according to the name type.
991+ *
992+ * @param string|null $name
993+ *
994+ * @return array<mixed>|null
995+ */
996+ protected function makeEmptyValue (?string $ name ) : ?array
997+ {
998+ return $ name === null ? [] : null ;
999+ }
1000+
9891001 /**
9901002 * Get POST data.
9911003 *
@@ -1008,7 +1020,7 @@ public function getPost(
10081020 if ($ this ->isMethod (Method::POST )) {
10091021 return $ this ->getFilteredParsedBody ($ name , $ filter , $ filterOptions );
10101022 }
1011- return $ name === null ? [] : null ;
1023+ return $ this -> makeEmptyValue ( $ name) ;
10121024 }
10131025
10141026 /**
@@ -1030,7 +1042,7 @@ public function getPatch(
10301042 if ($ this ->isMethod (Method::PATCH )) {
10311043 return $ this ->getFilteredParsedBody ($ name , $ filter , $ filterOptions );
10321044 }
1033- return $ name === null ? [] : null ;
1045+ return $ this -> makeEmptyValue ( $ name) ;
10341046 }
10351047
10361048 /**
@@ -1052,7 +1064,7 @@ public function getPut(
10521064 if ($ this ->isMethod (Method::PUT )) {
10531065 return $ this ->getFilteredParsedBody ($ name , $ filter , $ filterOptions );
10541066 }
1055- return $ name === null ? [] : null ;
1067+ return $ this -> makeEmptyValue ( $ name) ;
10561068 }
10571069
10581070 /**
0 commit comments