refactor: add no_useless_else lint rule

Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com>
This commit is contained in:
Saw-jan
2025-06-19 10:58:37 +05:45
parent 43865a9646
commit 625dc16417
12 changed files with 51 additions and 68 deletions

View File

@@ -117,14 +117,12 @@ trait Provisioning {
if (\array_key_exists($normalizedUsername, $usersList)) {
if (\array_key_exists($attribute, $usersList[$normalizedUsername])) {
return $usersList[$normalizedUsername][$attribute];
} else {
throw new Exception(
__METHOD__ . ": User '$user' has no attribute with name '$attribute'."
);
}
} else {
return false;
throw new Exception(
__METHOD__ . ": User '$user' has no attribute with name '$attribute'."
);
}
return false;
}
/**
@@ -139,14 +137,12 @@ trait Provisioning {
if (\array_key_exists($group, $groupsList)) {
if (\array_key_exists($attribute, $groupsList[$group])) {
return $groupsList[$group][$attribute];
} else {
throw new Exception(
__METHOD__ . ": Group '$group' has no attribute with name '$attribute'."
);
}
} else {
return false;
throw new Exception(
__METHOD__ . ": Group '$group' has no attribute with name '$attribute'."
);
}
return false;
}
/**