| Total Complexity | 3 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | trait FormDataAttribute |
||
| 9 | { |
||
| 10 | |||
| 11 | /** |
||
| 12 | * 判断内容是否为JSON |
||
| 13 | * |
||
| 14 | * @return boolean |
||
| 15 | */ |
||
| 16 | public function isJson():bool { |
||
| 17 | |||
| 18 | } |
||
|
|
|||
| 19 | |||
| 20 | /** |
||
| 21 | * 判断是否是POST请求 |
||
| 22 | * |
||
| 23 | * @return boolean |
||
| 24 | */ |
||
| 25 | public function isPost():bool { |
||
| 26 | |||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * 判断是否为GET请求 |
||
| 31 | * |
||
| 32 | * @return boolean |
||
| 33 | */ |
||
| 34 | public function isGet():bool { |
||
| 35 | |||
| 36 | } |
||
| 37 | } |
||
| 38 |
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: