Skip to content

Commit

Permalink
Merge pull request doctrine#3573 from jwage/id-types
Browse files Browse the repository at this point in the history
Add proper types to Doctrine\DBAL\Id namespace.
  • Loading branch information
morozov committed May 31, 2019
2 parents 74caae5 + 742fb98 commit 618dc4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
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

0 comments on commit 618dc4e

Please sign in to comment.