Conditions | 3 |
Paths | 3 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 7 | ||
Bugs | 4 | Features | 0 |
1 | <?php |
||
37 | public function get($userID, $serverID) |
||
38 | { |
||
39 | foreach ($this->config->get("admins", "permissions") as $adminID) { |
||
|
|||
40 | if ($adminID == $userID) { |
||
41 | return 2; |
||
42 | } |
||
43 | } |
||
44 | |||
45 | return $this->db->queryField("SELECT permission FROM permissions WHERE userID = :userID AND serverID = :serverID", "permission", [":userID" => $userID, ":serverID" => $serverID]); |
||
46 | } |
||
47 | |||
58 | } |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.