CI: Fix Psalm checks

InvalidConsoleOptionValue
TooFewArguments
UnhandledMatchCondition
UndefinedVariable
pull/6024/head
Angel Fernando Quiroz Campos 8 months ago
parent af44d268fb
commit 985b98a971
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 3
      src/CoreBundle/Command/SendScheduledAnnouncementsCommand.php
  2. 2
      src/CoreBundle/Controller/OAuth2/AbstractProviderController.php
  3. 3
      src/CoreBundle/Decorator/OAuth2ProviderFactoryDecorator.php
  4. 4
      src/CoreBundle/Form/DataTransformer/ResourceToIdentifierTransformer.php

@ -14,6 +14,7 @@ use Doctrine\ORM\EntityManager;
use Exception; use Exception;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
@ -36,7 +37,7 @@ class SendScheduledAnnouncementsCommand extends Command
{ {
$this $this
->setDescription('Send scheduled announcements to all users.') ->setDescription('Send scheduled announcements to all users.')
->addOption('debug', null, null, 'If set, debug messages will be shown.') ->addOption('debug', null, InputOption::VALUE_NONE, 'If set, debug messages will be shown.')
; ;
} }

@ -22,6 +22,6 @@ abstract class AbstractProviderController extends AbstractController
throw $this->createAccessDeniedException(); throw $this->createAccessDeniedException();
} }
return $clientRegistry->getClient($providerName)->redirect(); return $clientRegistry->getClient($providerName)->redirect([], []);
} }
} }

@ -7,6 +7,7 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Decorator; namespace Chamilo\CoreBundle\Decorator;
use Chamilo\CoreBundle\ServiceHelper\AuthenticationConfigHelper; use Chamilo\CoreBundle\ServiceHelper\AuthenticationConfigHelper;
use InvalidArgumentException;
use KnpU\OAuth2ClientBundle\DependencyInjection\ProviderFactory; use KnpU\OAuth2ClientBundle\DependencyInjection\ProviderFactory;
use League\OAuth2\Client\Provider\AbstractProvider; use League\OAuth2\Client\Provider\AbstractProvider;
use League\OAuth2\Client\Provider\Facebook; use League\OAuth2\Client\Provider\Facebook;
@ -37,6 +38,7 @@ readonly class OAuth2ProviderFactoryDecorator
Facebook::class => $this->authenticationConfigHelper->getProviderConfig('facebook'), Facebook::class => $this->authenticationConfigHelper->getProviderConfig('facebook'),
Keycloak::class => $this->authenticationConfigHelper->getProviderConfig('keycloak'), Keycloak::class => $this->authenticationConfigHelper->getProviderConfig('keycloak'),
Azure::class => $this->authenticationConfigHelper->getProviderConfig('azure'), Azure::class => $this->authenticationConfigHelper->getProviderConfig('azure'),
default => throw new InvalidArgumentException("Unsupported provider class: $class"),
}; };
$redirectParams = $customConfig['redirect_params'] ?? []; $redirectParams = $customConfig['redirect_params'] ?? [];
@ -53,6 +55,7 @@ readonly class OAuth2ProviderFactoryDecorator
Facebook::class => $this->authenticationConfigHelper->getProviderOptions('facebook', $customConfig), Facebook::class => $this->authenticationConfigHelper->getProviderOptions('facebook', $customConfig),
Keycloak::class => $this->authenticationConfigHelper->getProviderOptions('keycloak', $customConfig), Keycloak::class => $this->authenticationConfigHelper->getProviderOptions('keycloak', $customConfig),
Azure::class => $this->authenticationConfigHelper->getProviderOptions('azure', $customConfig), Azure::class => $this->authenticationConfigHelper->getProviderOptions('azure', $customConfig),
default => throw new \InvalidArgumentException("Unsupported provider class: $class"),
}; };
$options = $customOptions + $options; $options = $customOptions + $options;

@ -23,7 +23,7 @@ final class ResourceToIdentifierTransformer implements DataTransformerInterface
$this->identifier = $identifier ?? 'id'; $this->identifier = $identifier ?? 'id';
} }
public function transform($value) public function transform($value): mixed
{ {
if (null === $value) { if (null === $value) {
return null; return null;
@ -40,7 +40,7 @@ final class ResourceToIdentifierTransformer implements DataTransformerInterface
return $value; return $value;
} }
public function reverseTransform($value) public function reverseTransform($value): mixed
{ {
if (null === $value || '' === $value) { if (null === $value || '' === $value) {
return null; return null;

Loading…
Cancel
Save