Skip to content

Commit

Permalink
cs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaicher committed May 12, 2020
1 parent 6731f53 commit b01d36e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use const E_USER_DEPRECATED;
use function array_keys;
use function assert;
use function count;
use function implode;
use function is_string;
use function trigger_error;
use const E_USER_DEPRECATED;

class ReservedWordsCommand extends Command
{
Expand Down Expand Up @@ -200,8 +201,8 @@ protected function execute(InputInterface $input, OutputInterface $output)

private function getConnection(InputInterface $input) : Connection
{
/** @var string|null $connectionName */
$connectionName = $input->getOption('connection');
assert(is_string($connectionName) || $connectionName === null);

if ($this->connectionProvider === null) {
if ($connectionName !== null) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use const E_USER_DEPRECATED;
use function assert;
use function is_numeric;
use function is_string;
use function stripos;
use function trigger_error;
use const E_USER_DEPRECATED;

/**
* Task for executing arbitrary SQL that can come from a file or directly from
Expand Down Expand Up @@ -92,8 +92,8 @@ protected function execute(InputInterface $input, OutputInterface $output)

private function getConnection(InputInterface $input) : Connection
{
/** @var string|null $connectionName */
$connectionName = $input->getOption('connection');
assert(is_string($connectionName) || $connectionName === null);

if ($this->connectionProvider === null) {
if ($connectionName !== null) {
Expand Down
5 changes: 3 additions & 2 deletions lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\HelperSet;
use TypeError;
use const E_USER_DEPRECATED;
use function assert;
use function sprintf;
use function trigger_error;
use const E_USER_DEPRECATED;

/**
* Handles running the Console Tools inside Symfony Console context.
Expand Down Expand Up @@ -49,8 +50,8 @@ public static function run($helperSetOrConnectionProvider, $commands = [])

$cli->setCatchExceptions(true);

/** @var ConnectionProvider|null $connectionProvider */
$connectionProvider = null;
assert($connectionProvider instanceof ConnectionProvider || $connectionProvider === null);
if ($helperSetOrConnectionProvider instanceof HelperSet) {
@trigger_error(sprintf('Passing an instance of "%s" as the first argument is deprecated. Pass an instance of "%s" instead.', HelperSet::class, ConnectionProvider::class), E_USER_DEPRECATED);
$connectionProvider = null;
Expand Down

0 comments on commit b01d36e

Please sign in to comment.