Skip to content

Commit

Permalink
Improve array key types in Doctrine\DBAL\Types namespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwage committed May 30, 2019
1 parent 4ebb488 commit 0abe4f2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/Doctrine/DBAL/Types/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public function convertToPHPValue($value, AbstractPlatform $platform)
/**
* Gets the SQL declaration snippet for a field of this type.
*
* @param mixed[] $fieldDeclaration The field declaration.
* @param AbstractPlatform $platform The currently used database platform.
* @param array<string, mixed> $fieldDeclaration The field declaration.
* @param AbstractPlatform $platform The currently used database platform.
*/
abstract public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string;

Expand Down Expand Up @@ -258,7 +258,7 @@ public function getBindingType() : int
* Gets the types array map which holds all registered types and the corresponding
* type class
*
* @return string[]
* @return array<string, string>
*/
public static function getTypesMap() : array
{
Expand Down Expand Up @@ -302,7 +302,7 @@ public function convertToPHPValueSQL(string $sqlExpr, AbstractPlatform $platform
/**
* Gets an array of database types that map to this Doctrine type.
*
* @return string[]
* @return array<int, string>
*/
public function getMappedDatabaseTypes(AbstractPlatform $platform) : array
{
Expand Down
6 changes: 5 additions & 1 deletion lib/Doctrine/DBAL/Types/TypeRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
*/
final class TypeRegistry
{
/** @var array<string, Type> Map of type names and their corresponding flyweight objects. */
/**
* Map of type names and their corresponding flyweight objects.
*
* @var array<string, Type>
*/
private $instances = [];

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/Doctrine/Tests/Types/MySqlPointType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ class MySqlPointType extends Type
/**
* {@inheritDoc}
*/
public function getName()
public function getName() : string
{
return 'point';
}

/**
* {@inheritDoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{
return strtoupper($this->getName());
}

/**
* {@inheritDoc}
*/
public function getMappedDatabaseTypes(AbstractPlatform $platform)
public function getMappedDatabaseTypes(AbstractPlatform $platform) : array
{
return ['point'];
}
Expand Down

0 comments on commit 0abe4f2

Please sign in to comment.