Unverified Commit 1c48cfe0 authored by Jonathan H. Wage's avatar Jonathan H. Wage Committed by Sergei Morozov

Add proper types to Doctrine\DBAL\Tools namespace.

parent f90c5001
...@@ -30,7 +30,7 @@ use function sprintf; ...@@ -30,7 +30,7 @@ use function sprintf;
class ReservedWordsCommand extends Command class ReservedWordsCommand extends Command
{ {
/** @var string[] */ /** @var array<string, string> */
private $keywordListClasses = [ private $keywordListClasses = [
'db2' => DB2Keywords::class, 'db2' => DB2Keywords::class,
'mysql' => MySQLKeywords::class, 'mysql' => MySQLKeywords::class,
...@@ -48,13 +48,8 @@ class ReservedWordsCommand extends Command ...@@ -48,13 +48,8 @@ class ReservedWordsCommand extends Command
/** /**
* If you want to add or replace a keywords list use this command. * If you want to add or replace a keywords list use this command.
*
* @param string $name
* @param string $class
*
* @return void
*/ */
public function setKeywordListClass($name, $class) public function setKeywordListClass(string $name, string $class) : void
{ {
$this->keywordListClasses[$name] = $class; $this->keywordListClasses[$name] = $class;
} }
...@@ -62,7 +57,7 @@ class ReservedWordsCommand extends Command ...@@ -62,7 +57,7 @@ class ReservedWordsCommand extends Command
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function configure() protected function configure() : void
{ {
$this $this
->setName('dbal:reserved-words') ->setName('dbal:reserved-words')
......
...@@ -26,7 +26,7 @@ class RunSqlCommand extends Command ...@@ -26,7 +26,7 @@ class RunSqlCommand extends Command
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function configure() protected function configure() : void
{ {
$this $this
->setName('dbal:run-sql') ->setName('dbal:run-sql')
......
...@@ -20,10 +20,8 @@ class ConsoleRunner ...@@ -20,10 +20,8 @@ class ConsoleRunner
{ {
/** /**
* Create a Symfony Console HelperSet * Create a Symfony Console HelperSet
*
* @return HelperSet
*/ */
public static function createHelperSet(Connection $connection) public static function createHelperSet(Connection $connection) : HelperSet
{ {
return new HelperSet([ return new HelperSet([
'db' => new ConnectionHelper($connection), 'db' => new ConnectionHelper($connection),
...@@ -33,11 +31,9 @@ class ConsoleRunner ...@@ -33,11 +31,9 @@ class ConsoleRunner
/** /**
* Runs console with the given helperset. * Runs console with the given helperset.
* *
* @param Command[] $commands * @param array<int, Command> $commands
*
* @return void
*/ */
public static function run(HelperSet $helperSet, $commands = []) public static function run(HelperSet $helperSet, array $commands = []) : void
{ {
$cli = new Application('Doctrine Command Line Interface', Versions::getVersion('doctrine/dbal')); $cli = new Application('Doctrine Command Line Interface', Versions::getVersion('doctrine/dbal'));
...@@ -50,10 +46,7 @@ class ConsoleRunner ...@@ -50,10 +46,7 @@ class ConsoleRunner
$cli->run(); $cli->run();
} }
/** public static function addCommands(Application $cli) : void
* @return void
*/
public static function addCommands(Application $cli)
{ {
$cli->addCommands([ $cli->addCommands([
new RunSqlCommand(), new RunSqlCommand(),
...@@ -64,7 +57,7 @@ class ConsoleRunner ...@@ -64,7 +57,7 @@ class ConsoleRunner
/** /**
* Prints the instructions to create a configuration file * Prints the instructions to create a configuration file
*/ */
public static function printCliConfigTemplate() public static function printCliConfigTemplate() : void
{ {
echo <<<'HELP' echo <<<'HELP'
You are missing a "cli-config.php" or "config/cli-config.php" file in your You are missing a "cli-config.php" or "config/cli-config.php" file in your
......
...@@ -29,10 +29,8 @@ class ConnectionHelper extends Helper ...@@ -29,10 +29,8 @@ class ConnectionHelper extends Helper
/** /**
* Retrieves the Doctrine database Connection. * Retrieves the Doctrine database Connection.
*
* @return Connection
*/ */
public function getConnection() public function getConnection() : Connection
{ {
return $this->_connection; return $this->_connection;
} }
......
...@@ -59,7 +59,7 @@ final class Dumper ...@@ -59,7 +59,7 @@ final class Dumper
{ {
$html = ini_get('html_errors'); $html = ini_get('html_errors');
if ($html !== true) { if ($html !== '1') {
ini_set('html_errors', '1'); ini_set('html_errors', '1');
} }
...@@ -142,11 +142,9 @@ final class Dumper ...@@ -142,11 +142,9 @@ final class Dumper
* Fill the $return variable with class attributes * Fill the $return variable with class attributes
* Based on obj2array function from {@see https://secure.php.net/manual/en/function.get-object-vars.php#47075} * Based on obj2array function from {@see https://secure.php.net/manual/en/function.get-object-vars.php#47075}
* *
* @param object $var
*
* @return mixed * @return mixed
*/ */
private static function fillReturnWithClassAttributes($var, stdClass $return, int $maxDepth) private static function fillReturnWithClassAttributes(object $var, stdClass $return, int $maxDepth)
{ {
$clone = (array) $var; $clone = (array) $var;
...@@ -162,10 +160,7 @@ final class Dumper ...@@ -162,10 +160,7 @@ final class Dumper
return $return; return $return;
} }
/** private static function getClass(object $object) : string
* @param object $object
*/
private static function getClass($object) : string
{ {
$class = get_class($object); $class = get_class($object);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment