Fix php errors (reported by gh actions)

pull/3890/head
Julio Montoya 5 years ago
parent ec8fd557d7
commit 5248b07224
  1. 4
      composer.json
  2. 1
      ecs.php
  3. 2
      public/main/inc/global.inc.php
  4. 3
      src/CoreBundle/Controller/ExceptionController.php
  5. 7
      src/CoreBundle/EventListener/TwigListener.php
  6. 1
      src/CoreBundle/Security/LoginFormAuthenticator.php
  7. 2
      tests/phpstan/doctrine-orm-bootstrap.php

@ -160,8 +160,8 @@
"phpstan/phpstan-doctrine": "^0.12",
"phpstan/phpstan-symfony": "^0.12",
"psalm/plugin-symfony": "^2.0",
"rector/rector": "^0.9",
"slevomat/coding-standard": "^6.4",
"rector/rector": "^0.10",
"slevomat/coding-standard": "^7.0",
"symfony/browser-kit": "^4.0|^5.0",
"symfony/css-selector": "^5.0",
"symfony/debug-pack": "*",

@ -91,6 +91,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
//__DIR__.'/src/LtiBundle/*',
IncrementStyleFixer::class => 'post',
PropertyTypeHintSniff::class.'.'.PropertyTypeHintSniff::CODE_MISSING_TRAVERSABLE_TYPE_HINT_SPECIFICATION,
PropertyTypeHintSniff::class.'.'.PropertyTypeHintSniff::CODE_MISSING_NATIVE_TYPE_HINT,
\PhpCsFixer\Fixer\DoctrineAnnotation\DoctrineAnnotationArrayAssignmentFixer::class,
\PhpCsFixer\Fixer\Comment\SingleLineCommentStyleFixer::class,
\PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer::class,

@ -108,7 +108,7 @@ try {
}
define('DEFAULT_DOCUMENT_QUOTA', $default_quota);*/
define('DEFAULT_DOCUMENT_QUOTA', 100000000);
} catch (FlattenException $e) {
} catch (Exception $e) {
$controller = new ExceptionController();
$controller->showAction($e);
}

@ -6,6 +6,7 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Controller;
use Exception;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\ErrorHandler\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request;
@ -14,7 +15,7 @@ use Symfony\Component\Routing\Annotation\Route;
class ExceptionController extends AbstractController
{
public function showAction(FlattenException $exception)
public function showAction(Exception $exception)
{
if ('dev' === $this->getParameter('app_env')) {
throw new HttpException($exception->getCode(), $exception->getMessage());

@ -11,7 +11,6 @@ use Chamilo\CoreBundle\Repository\Node\IllustrationRepository;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\SerializerInterface;
use Twig\Environment;
@ -47,8 +46,10 @@ class TwigListener
if ($user instanceof UserInterface) {
/** @var User $userClone */
$userClone = clone $user;
$data = $this->serializer->serialize($userClone, 'jsonld', ['groups' => ['user_json:read']]);
$avatar = $this->illustrationRepository->getIllustrationUrl($user);
$data = $this->serializer->serialize($userClone, 'jsonld', [
'groups' => ['user_json:read'],
]);
$avatar = $this->illustrationRepository->getIllustrationUrl($userClone);
$isAuth = true;
}
}

@ -132,6 +132,7 @@ class LoginFormAuthenticator extends AbstractGuardAuthenticator implements Passw
public function checkCredentials($credentials, UserInterface $user)
{
error_log('login form');
return $this->passwordEncoder->isPasswordValid($user, $credentials['password']);
/*$hook = $this->hookFactory->build(CheckLoginCredentialsHook::class);

@ -2,7 +2,7 @@
use Chamilo\Kernel;
require dirname(__DIR__).'/bootstrap.php';
require dirname(__DIR__).'/../vendor/autoload.php';
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$kernel->boot();

Loading…
Cancel
Save