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;
class ReservedWordsCommand extends Command
{
/** @var string[] */
/** @var array<string, string> */
private $keywordListClasses = [
'db2' => DB2Keywords::class,
'mysql' => MySQLKeywords::class,
......@@ -48,13 +48,8 @@ class ReservedWordsCommand extends 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;
}
......@@ -62,7 +57,7 @@ class ReservedWordsCommand extends Command
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure() : void
{
$this
->setName('dbal:reserved-words')
......
......@@ -26,7 +26,7 @@ class RunSqlCommand extends Command
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure() : void
{
$this
->setName('dbal:run-sql')
......
......@@ -20,10 +20,8 @@ class ConsoleRunner
{
/**
* Create a Symfony Console HelperSet
*
* @return HelperSet
*/
public static function createHelperSet(Connection $connection)
public static function createHelperSet(Connection $connection) : HelperSet
{
return new HelperSet([
'db' => new ConnectionHelper($connection),
......@@ -33,11 +31,9 @@ class ConsoleRunner
/**
* Runs console with the given helperset.
*
* @param Command[] $commands
*
* @return void
* @param array<int, Command> $commands
*/
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'));
......@@ -50,10 +46,7 @@ class ConsoleRunner
$cli->run();
}
/**
* @return void
*/
public static function addCommands(Application $cli)
public static function addCommands(Application $cli) : void
{
$cli->addCommands([
new RunSqlCommand(),
......@@ -64,7 +57,7 @@ class ConsoleRunner
/**
* Prints the instructions to create a configuration file
*/
public static function printCliConfigTemplate()
public static function printCliConfigTemplate() : void
{
echo <<<'HELP'
You are missing a "cli-config.php" or "config/cli-config.php" file in your
......
......@@ -29,10 +29,8 @@ class ConnectionHelper extends Helper
/**
* Retrieves the Doctrine database Connection.
*
* @return Connection
*/
public function getConnection()
public function getConnection() : Connection
{
return $this->_connection;
}
......
......@@ -59,7 +59,7 @@ final class Dumper
{
$html = ini_get('html_errors');
if ($html !== true) {
if ($html !== '1') {
ini_set('html_errors', '1');
}
......@@ -142,11 +142,9 @@ final class Dumper
* 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}
*
* @param object $var
*
* @return mixed
*/
private static function fillReturnWithClassAttributes($var, stdClass $return, int $maxDepth)
private static function fillReturnWithClassAttributes(object $var, stdClass $return, int $maxDepth)
{
$clone = (array) $var;
......@@ -162,10 +160,7 @@ final class Dumper
return $return;
}
/**
* @param object $object
*/
private static function getClass($object) : string
private static function getClass(object $object) : string
{
$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