Conditions | 3 |
Paths | 3 |
Total Lines | 8 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
29 | public function isAllowed($parameter = NULL): bool { |
||
30 | 1 | if(!is_string($parameter)) { |
|
31 | 1 | throw new \InvalidArgumentException("Method " . static::class . "::isAllowed expects string as parameter."); |
|
32 | 1 | } elseif(!Strings::contains($parameter, ":")) { |
|
33 | 1 | throw new \OutOfBoundsException("Method " . static::class . "::isAllowed expects parameter in format resource:privilege."); |
|
34 | } |
||
35 | 1 | return $this->user->isAllowed(Strings::before($parameter, ":"), Strings::after($parameter, ":")); |
|
36 | } |
||
37 | } |
||
38 | ?> |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.