Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper types to Doctrine\DBAL\Id namespace. #3573

Merged
merged 1 commit into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions lib/Doctrine/DBAL/Id/TableGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,13 @@ class TableGenerator
/** @var string */
private $generatorTableName;

/** @var mixed[][] */
/** @var array<string, array<string, int>> */
private $sequences = [];

/**
* @param string $generatorTableName
*
* @throws DBALException
*/
public function __construct(Connection $conn, $generatorTableName = 'sequences')
public function __construct(Connection $conn, string $generatorTableName = 'sequences')
{
$params = $conn->getParams();
if ($params['driver'] === 'pdo_sqlite') {
Expand All @@ -80,13 +78,9 @@ public function __construct(Connection $conn, $generatorTableName = 'sequences')
/**
* Generates the next unused value for the given sequence name.
*
* @param string $sequenceName
*
* @return int
*
* @throws DBALException
*/
public function nextValue($sequenceName)
public function nextValue(string $sequenceName) : int
{
if (isset($this->sequences[$sequenceName])) {
$value = $this->sequences[$sequenceName]['value'];
Expand Down
5 changes: 1 addition & 4 deletions lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ class TableGeneratorSchemaVisitor implements Visitor
/** @var string */
private $generatorTableName;

/**
* @param string $generatorTableName
*/
public function __construct($generatorTableName = 'sequences')
public function __construct(string $generatorTableName = 'sequences')
{
$this->generatorTableName = $generatorTableName;
}
Expand Down