Fixed PHPstan issues for level 5.

This commit is contained in:
Jan Böhmer 2020-02-01 19:42:28 +01:00
parent a9293b7ceb
commit da72f5b3ec
24 changed files with 87 additions and 49 deletions

View file

@ -67,6 +67,6 @@ final class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface
}
$response = $event->getResponse();
$response->headers->set('Symfony-Debug-Toolbar-Replace', 1);
$response->headers->set('Symfony-Debug-Toolbar-Replace', '1');
}
}

View file

@ -25,6 +25,7 @@ declare(strict_types=1);
namespace App\EventSubscriber;
use App\Entity\UserSystem\U2FKey;
use App\Entity\UserSystem\User;
use Doctrine\ORM\EntityManagerInterface;
use R\U2FTwoFactorBundle\Event\RegisterEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@ -63,6 +64,10 @@ final class U2FRegistrationSubscriber implements EventSubscriberInterface
//Skip adding of U2F key on demo mode
if (! $this->demo_mode) {
$user = $event->getUser();
if (!$user instanceof User) {
throw new \InvalidArgumentException("Only User objects can be registered for U2F!");
}
$registration = $event->getRegistration();
$newKey = new U2FKey();
$newKey->fromRegistrationData($registration);