Skip to content

Commit

Permalink
fix(psalm): Enable OpenAPI rules
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <kate@provokateurin.de>
  • Loading branch information
provokateurin committed Jan 7, 2025
1 parent 6bb55d3 commit e353055
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/Service/RecommendationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public function __construct(RecentlyCommentedFilesSource $recentlyCommented,
}

/**
* @param IRecommendation[] $recommendations
* @param list<IRecommendation> $recommendations
*
* @return IRecommendation[]
* @return list<IRecommendation>
*/
private function sortRecommendations(array $recommendations): array {
usort($recommendations, function (IRecommendation $a, IRecommendation $b) {
Expand All @@ -49,9 +49,9 @@ private function sortRecommendations(array $recommendations): array {
}

/**
* @param IRecommendation[] $recommendations
* @param list<IRecommendation> $recommendations
*
* @return IRecommendation[]
* @return list<IRecommendation>
*/
private function addPreviews(array $recommendations): array {
foreach ($recommendations as $recommendation) {
Expand All @@ -65,7 +65,7 @@ private function addPreviews(array $recommendations): array {
/**
* @param IUser $user
*
* @return IRecommendation[]
* @return list<IRecommendation>
*/
public function getRecommendations(IUser $user, int $max = self::MAX_RECOMMENDATIONS): array {
$all = array_reduce($this->sources, function (array $carry, IRecommendationSource $source) use ($user) {
Expand All @@ -84,9 +84,9 @@ public function getRecommendations(IUser $user, int $max = self::MAX_RECOMMENDAT
* The first (most recent) recommendation wins, hence eventually show its
* recommendation reason
*
* @param IRecommendation[] $recommendations
* @param list<IRecommendation> $recommendations
* @param int $max
* @return IRecommendation[]
* @return list<IRecommendation>
*/
private function getDeduplicatedSlice(array $recommendations, int $max): array {
$picks = [];
Expand Down
6 changes: 6 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@
<extraFiles>
<directory name="vendor" />
</extraFiles>
<issueHandlers>
<LessSpecificReturnStatement errorLevel="error"/>
<LessSpecificReturnType errorLevel="error"/>
<LessSpecificImplementedReturnType errorLevel="error"/>
<MoreSpecificReturnType errorLevel="error"/>
</issueHandlers>
</psalm>

0 comments on commit e353055

Please sign in to comment.