Skip to content

Commit 9f5dead

Browse files
committed
Internal: Fix psalm reports
1 parent 6099f8b commit 9f5dead

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

src/CoreBundle/DataTransformer/SkillTreeNodeTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __construct(
1616
private SettingsManager $settingsManager,
1717
) {}
1818

19-
public function transform(Skill $object, string $to, array $context = []): SkillTreeNode
19+
public function transform(Skill $object): SkillTreeNode
2020
{
2121
$skillNode = new SkillTreeNode();
2222
$skillNode->id = $object->getId();
@@ -32,7 +32,7 @@ public function transform(Skill $object, string $to, array $context = []): Skill
3232
}
3333

3434
$skillNode->children = $object->getChildSkills()
35-
->map(fn (Skill $childSkill) => $this->transform($childSkill, $to, $context))
35+
->map(fn (Skill $childSkill) => $this->transform($childSkill))
3636
->toArray()
3737
;
3838

src/CoreBundle/State/GroupMembersStateProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function supports(Operation $operation, array $uriVariables = [], array $
2626
return Usergroup::class === $operation->getClass() && 'get_group_members' === $operation->getName();
2727
}
2828

29-
public function provide(Operation $operation, array $uriVariables = [], array $context = []): iterable
29+
public function provide(Operation $operation, array $uriVariables = [], array $context = []): array
3030
{
3131
$groupId = $uriVariables['id'] ?? null;
3232

src/CoreBundle/State/MessageByGroupStateProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function supports(Operation $operation, array $uriVariables = [], array $
2626
return Message::class === $operation->getClass() && 'get_messages_by_group' === $operation->getName();
2727
}
2828

29-
public function provide(Operation $operation, array $uriVariables = [], array $context = []): iterable
29+
public function provide(Operation $operation, array $uriVariables = [], array $context = []): array
3030
{
3131
$groupId = $context['filters']['groupId'] ?? null;
3232

src/CoreBundle/State/PublicCatalogueCourseStateProvider.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use ApiPlatform\Metadata\Operation;
1010
use ApiPlatform\State\ProviderInterface;
11+
use Chamilo\CoreBundle\Entity\AccessUrl;
1112
use Chamilo\CoreBundle\Entity\Course;
1213
use Chamilo\CoreBundle\Entity\ExtraField;
1314
use Chamilo\CoreBundle\Repository\ExtraFieldValuesRepository;
@@ -17,6 +18,9 @@
1718
use Symfony\Component\HttpFoundation\RequestStack;
1819
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
1920

21+
/**
22+
* @implements ProviderInterface<Course>
23+
*/
2024
readonly class PublicCatalogueCourseStateProvider implements ProviderInterface
2125
{
2226
public function __construct(
@@ -28,7 +32,7 @@ public function __construct(
2832
private TokenStorageInterface $tokenStorage
2933
) {}
3034

31-
public function provide(Operation $operation, array $uriVariables = [], array $context = []): array|object|null
35+
public function provide(Operation $operation, array $uriVariables = [], array $context = []): array
3236
{
3337
$user = $this->tokenStorage->getToken()?->getUser();
3438
$isAuthenticated = \is_object($user);
@@ -49,12 +53,13 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
4953
}
5054

5155
$host = $request->getSchemeAndHttpHost().'/';
56+
/** @var AccessUrl $accessUrl */
5257
$accessUrl = $this->accessUrlRepository->findOneBy(['url' => $host]) ?? $this->accessUrlRepository->find(1);
5358
$courses = $this->courseRepository->createQueryBuilder('c')
5459
->innerJoin('c.urls', 'url_rel')
5560
->andWhere('url_rel.url = :accessUrl')
5661
->andWhere('c.visibility IN (:visibilities)')
57-
->setParameter('accessUrl', $accessUrl)
62+
->setParameter('accessUrl', $accessUrl->getId())
5863
->setParameter('visibilities', [Course::OPEN_WORLD, Course::OPEN_PLATFORM])
5964
->orderBy('c.title', 'ASC')
6065
->getQuery()

src/CoreBundle/State/UsergroupStateProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(
2929
/**
3030
* @throws Exception
3131
*/
32-
public function provide(Operation $operation, array $uriVariables = [], array $context = []): iterable
32+
public function provide(Operation $operation, array $uriVariables = [], array $context = []): array
3333
{
3434
$operationName = $operation->getName();
3535
if ('get_usergroup' === $operationName) {

0 commit comments

Comments
 (0)