Skip to content

Commit c8a7c6c

Browse files
committed
bug #570 Fix autowiring type deprec & use ConsoleEvents::ERROR (ogizanagi)
This PR was merged into the master branch. Discussion ---------- Fix autowiring type deprec & use ConsoleEvents::ERROR Relates to symfony/symfony#22951 + use `ConsoleEvents::ERROR` rather than `ConsoleEvents::EXCEPTION` Commits ------- 4ebe39b Fix autowiring type deprec & use ConsoleEvents::ERROR
2 parents 4c900bb + 4ebe39b commit c8a7c6c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/AppBundle/Command/AddUserCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Symfony\Component\Console\Input\InputOption;
2020
use Symfony\Component\Console\Output\OutputInterface;
2121
use Symfony\Component\Console\Question\Question;
22-
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder;
22+
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
2323

2424
/**
2525
* A command console that creates users and stores them in the database.
@@ -47,7 +47,7 @@ class AddUserCommand extends Command
4747
private $entityManager;
4848
private $passwordEncoder;
4949

50-
public function __construct(EntityManagerInterface $em, UserPasswordEncoder $encoder)
50+
public function __construct(EntityManagerInterface $em, UserPasswordEncoderInterface $encoder)
5151
{
5252
parent::__construct();
5353

src/AppBundle/EventListener/CheckRequirementsSubscriber.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
namespace AppBundle\EventListener;
1313

1414
use Doctrine\DBAL\Exception\DriverException;
15-
use Doctrine\ORM\EntityManager;
15+
use Doctrine\ORM\EntityManagerInterface;
1616
use Symfony\Component\Console\ConsoleEvents;
17-
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
17+
use Symfony\Component\Console\Event\ConsoleErrorEvent;
1818
use Symfony\Component\Console\Style\SymfonyStyle;
1919
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
2020
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
@@ -30,13 +30,13 @@
3030
*/
3131
class CheckRequirementsSubscriber implements EventSubscriberInterface
3232
{
33-
/** @var EntityManager */
33+
/** @var EntityManagerInterface */
3434
private $entityManager;
3535

3636
/**
37-
* @param EntityManager $entityManager
37+
* @param EntityManagerInterface $entityManager
3838
*/
39-
public function __construct(EntityManager $entityManager)
39+
public function __construct(EntityManagerInterface $entityManager)
4040
{
4141
$this->entityManager = $entityManager;
4242
}
@@ -48,22 +48,22 @@ public function __construct(EntityManager $entityManager)
4848
public static function getSubscribedEvents()
4949
{
5050
return [
51-
// Exceptions are one of the events defined by the Console. See the
51+
// Errors are one of the events defined by the Console. See the
5252
// rest here: https://symfony.com/doc/current/components/console/events.html
53-
ConsoleEvents::EXCEPTION => 'handleConsoleException',
53+
ConsoleEvents::ERROR => 'handleConsoleError',
5454
// See: http://api.symfony.com/master/Symfony/Component/HttpKernel/KernelEvents.html
5555
KernelEvents::EXCEPTION => 'handleKernelException',
5656
];
5757
}
5858

5959
/**
60-
* This method checks if there has been an exception in a command related to
60+
* This method checks if there has been an error in a command related to
6161
* the database and then, it checks if the 'sqlite3' PHP extension is enabled
6262
* or not to display a better error message.
6363
*
64-
* @param ConsoleExceptionEvent $event
64+
* @param ConsoleErrorEvent $event
6565
*/
66-
public function handleConsoleException(ConsoleExceptionEvent $event)
66+
public function handleConsoleError(ConsoleErrorEvent $event)
6767
{
6868
$commandNames = ['doctrine:fixtures:load', 'doctrine:database:create', 'doctrine:schema:create', 'doctrine:database:drop'];
6969

0 commit comments

Comments
 (0)