Return types

This commit is contained in:
2024-07-22 02:36:28 +02:00
parent af588ab174
commit 2168e37413
12 changed files with 35 additions and 46 deletions
+8 -8
View File
@@ -11,10 +11,10 @@ use Khofmann\Request\Request;
class User extends Api
{
public function get($id)
public function get($id): void
{
try {
return Response::json(MUser::getByID($id));
Response::json(MUser::getByID($id));
} catch (Exception $err) {
switch ($err->getMessage()) {
case "NotFound":
@@ -25,14 +25,14 @@ class User extends Api
}
}
public function patch($id)
public function patch($id): void
{
$username = Input::patch("username");
$password = Input::patch("password");
$image = Input::file("image");
try {
return Response::json(MUser::getByID($id)->update($username, $password, $image));
Response::json(MUser::getByID($id)->update($username, $password, $image));
} catch (Exception $err) {
switch ($err->getMessage()) {
case "NotFound":
@@ -49,7 +49,7 @@ class User extends Api
}
}
public function patchSelf()
public function patchSelf(): void
{
$token = Request::header("token");
$username = Input::patch("username");
@@ -57,7 +57,7 @@ class User extends Api
$image = Input::file("image");
try {
return Response::json(MUser::getByToken($token)->update($username, $password, $image));
Response::json(MUser::getByToken($token)->update($username, $password, $image));
} catch (Exception $err) {
switch ($err->getMessage()) {
case "NotFound":
@@ -74,10 +74,10 @@ class User extends Api
}
}
public function delete($id)
public function delete($id): void
{
try {
return Response::json(MUser::getByID($id)->delete());
Response::json(MUser::getByID($id)->delete());
} catch (Exception $err) {
switch ($err->getMessage()) {
case "NotFound":