| Conditions | 8 |
| Paths | 8 |
| Total Lines | 10 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 72 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | protected function getIconClass(string $category): string |
||
| 29 | { |
||
| 30 | switch($category) { |
||
| 31 | case CommunityNews::CATEGORY_COMMUNITY_CREATION: return 'fas fa-plus-circle'; |
||
| 32 | case CommunityNews::CATEGORY_NEW_MEMBER: return 'fas fa-user-plus'; |
||
| 33 | case CommunityNews::CATEGORY_NEW_PROJECT: return 'fas fa-paper-plane'; |
||
| 34 | case ProjectNews::CATEGORY_NEW_COMMUNITY: return 'fas fa-users'; |
||
| 35 | case ProjectNews::CATEGORY_NEW_MEMBER: return 'fas fa-user-plus'; |
||
| 36 | case ProjectNews::CATEGORY_NEW_RELEASE: return 'fas fa-rocket'; |
||
| 37 | case ProjectNews::CATEGORY_NEW_REPOSITORY: return 'fas fa-cogs'; |
||
|
|
|||
| 38 | } |
||
| 40 | } |
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: