Unverified Commit 0382f44f authored by Jonathan H. Wage's avatar Jonathan H. Wage Committed by Sergei Morozov

Add proper types to Doctrine\DBAL\Types namespace.

parent 4b3f0ee1
...@@ -21,7 +21,7 @@ class ArrayType extends Type ...@@ -21,7 +21,7 @@ class ArrayType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getClobTypeDeclarationSQL($fieldDeclaration); return $platform->getClobTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -60,7 +60,7 @@ class ArrayType extends Type ...@@ -60,7 +60,7 @@ class ArrayType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::ARRAY; return Types::ARRAY;
} }
...@@ -68,7 +68,7 @@ class ArrayType extends Type ...@@ -68,7 +68,7 @@ class ArrayType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return true; return true;
} }
......
...@@ -15,7 +15,7 @@ class BigIntType extends Type implements PhpIntegerMappingType ...@@ -15,7 +15,7 @@ class BigIntType extends Type implements PhpIntegerMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::BIGINT; return Types::BIGINT;
} }
...@@ -23,7 +23,7 @@ class BigIntType extends Type implements PhpIntegerMappingType ...@@ -23,7 +23,7 @@ class BigIntType extends Type implements PhpIntegerMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getBigIntTypeDeclarationSQL($fieldDeclaration); return $platform->getBigIntTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -31,7 +31,7 @@ class BigIntType extends Type implements PhpIntegerMappingType ...@@ -31,7 +31,7 @@ class BigIntType extends Type implements PhpIntegerMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getBindingType() public function getBindingType() : int
{ {
return ParameterType::STRING; return ParameterType::STRING;
} }
......
...@@ -19,7 +19,7 @@ class BinaryType extends Type ...@@ -19,7 +19,7 @@ class BinaryType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getBinaryTypeDeclarationSQL($fieldDeclaration); return $platform->getBinaryTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -47,7 +47,7 @@ class BinaryType extends Type ...@@ -47,7 +47,7 @@ class BinaryType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::BINARY; return Types::BINARY;
} }
...@@ -55,7 +55,7 @@ class BinaryType extends Type ...@@ -55,7 +55,7 @@ class BinaryType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getBindingType() public function getBindingType() : int
{ {
return ParameterType::BINARY; return ParameterType::BINARY;
} }
......
...@@ -22,7 +22,7 @@ class BlobType extends Type ...@@ -22,7 +22,7 @@ class BlobType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getBlobTypeDeclarationSQL($fieldDeclaration); return $platform->getBlobTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -54,7 +54,7 @@ class BlobType extends Type ...@@ -54,7 +54,7 @@ class BlobType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::BLOB; return Types::BLOB;
} }
...@@ -62,7 +62,7 @@ class BlobType extends Type ...@@ -62,7 +62,7 @@ class BlobType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getBindingType() public function getBindingType() : int
{ {
return ParameterType::LARGE_OBJECT; return ParameterType::LARGE_OBJECT;
} }
......
...@@ -15,7 +15,7 @@ class BooleanType extends Type ...@@ -15,7 +15,7 @@ class BooleanType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getBooleanTypeDeclarationSQL($fieldDeclaration); return $platform->getBooleanTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -39,7 +39,7 @@ class BooleanType extends Type ...@@ -39,7 +39,7 @@ class BooleanType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::BOOLEAN; return Types::BOOLEAN;
} }
...@@ -47,7 +47,7 @@ class BooleanType extends Type ...@@ -47,7 +47,7 @@ class BooleanType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getBindingType() public function getBindingType() : int
{ {
return ParameterType::BOOLEAN; return ParameterType::BOOLEAN;
} }
......
...@@ -17,7 +17,7 @@ class DateImmutableType extends DateType ...@@ -17,7 +17,7 @@ class DateImmutableType extends DateType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::DATE_IMMUTABLE; return Types::DATE_IMMUTABLE;
} }
...@@ -67,7 +67,7 @@ class DateImmutableType extends DateType ...@@ -67,7 +67,7 @@ class DateImmutableType extends DateType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return true; return true;
} }
......
...@@ -21,7 +21,7 @@ class DateIntervalType extends Type ...@@ -21,7 +21,7 @@ class DateIntervalType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::DATEINTERVAL; return Types::DATEINTERVAL;
} }
...@@ -29,7 +29,7 @@ class DateIntervalType extends Type ...@@ -29,7 +29,7 @@ class DateIntervalType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
$fieldDeclaration['length'] = 255; $fieldDeclaration['length'] = 255;
...@@ -84,7 +84,7 @@ class DateIntervalType extends Type ...@@ -84,7 +84,7 @@ class DateIntervalType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return true; return true;
} }
......
...@@ -18,7 +18,7 @@ class DateTimeImmutableType extends DateTimeType ...@@ -18,7 +18,7 @@ class DateTimeImmutableType extends DateTimeType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::DATETIME_IMMUTABLE; return Types::DATETIME_IMMUTABLE;
} }
...@@ -72,7 +72,7 @@ class DateTimeImmutableType extends DateTimeType ...@@ -72,7 +72,7 @@ class DateTimeImmutableType extends DateTimeType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return true; return true;
} }
......
...@@ -19,7 +19,7 @@ class DateTimeType extends Type implements PhpDateTimeMappingType ...@@ -19,7 +19,7 @@ class DateTimeType extends Type implements PhpDateTimeMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::DATETIME_MUTABLE; return Types::DATETIME_MUTABLE;
} }
...@@ -27,7 +27,7 @@ class DateTimeType extends Type implements PhpDateTimeMappingType ...@@ -27,7 +27,7 @@ class DateTimeType extends Type implements PhpDateTimeMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getDateTimeTypeDeclarationSQL($fieldDeclaration); return $platform->getDateTimeTypeDeclarationSQL($fieldDeclaration);
} }
......
...@@ -17,7 +17,7 @@ class DateTimeTzImmutableType extends DateTimeTzType ...@@ -17,7 +17,7 @@ class DateTimeTzImmutableType extends DateTimeTzType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::DATETIMETZ_IMMUTABLE; return Types::DATETIMETZ_IMMUTABLE;
} }
...@@ -67,7 +67,7 @@ class DateTimeTzImmutableType extends DateTimeTzType ...@@ -67,7 +67,7 @@ class DateTimeTzImmutableType extends DateTimeTzType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return true; return true;
} }
......
...@@ -31,7 +31,7 @@ class DateTimeTzType extends Type implements PhpDateTimeMappingType ...@@ -31,7 +31,7 @@ class DateTimeTzType extends Type implements PhpDateTimeMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::DATETIMETZ_MUTABLE; return Types::DATETIMETZ_MUTABLE;
} }
...@@ -39,7 +39,7 @@ class DateTimeTzType extends Type implements PhpDateTimeMappingType ...@@ -39,7 +39,7 @@ class DateTimeTzType extends Type implements PhpDateTimeMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getDateTimeTzTypeDeclarationSQL($fieldDeclaration); return $platform->getDateTimeTzTypeDeclarationSQL($fieldDeclaration);
} }
......
...@@ -18,7 +18,7 @@ class DateType extends Type ...@@ -18,7 +18,7 @@ class DateType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::DATE_MUTABLE; return Types::DATE_MUTABLE;
} }
...@@ -26,7 +26,7 @@ class DateType extends Type ...@@ -26,7 +26,7 @@ class DateType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getDateTypeDeclarationSQL($fieldDeclaration); return $platform->getDateTypeDeclarationSQL($fieldDeclaration);
} }
......
...@@ -14,7 +14,7 @@ class DecimalType extends Type ...@@ -14,7 +14,7 @@ class DecimalType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::DECIMAL; return Types::DECIMAL;
} }
...@@ -22,7 +22,7 @@ class DecimalType extends Type ...@@ -22,7 +22,7 @@ class DecimalType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getDecimalTypeDeclarationSQL($fieldDeclaration); return $platform->getDecimalTypeDeclarationSQL($fieldDeclaration);
} }
......
...@@ -15,7 +15,10 @@ use function substr; ...@@ -15,7 +15,10 @@ use function substr;
*/ */
final class ValueNotConvertible extends ConversionException implements TypesException final class ValueNotConvertible extends ConversionException implements TypesException
{ {
public static function new($value, $toType, ?string $message = null) : self /**
* @param mixed $value
*/
public static function new($value, string $toType, ?string $message = null) : self
{ {
if ($message !== null) { if ($message !== null) {
return new self( return new self(
......
...@@ -11,7 +11,7 @@ class FloatType extends Type ...@@ -11,7 +11,7 @@ class FloatType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::FLOAT; return Types::FLOAT;
} }
...@@ -19,7 +19,7 @@ class FloatType extends Type ...@@ -19,7 +19,7 @@ class FloatType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getFloatDeclarationSQL($fieldDeclaration); return $platform->getFloatDeclarationSQL($fieldDeclaration);
} }
......
...@@ -14,7 +14,7 @@ class GuidType extends StringType ...@@ -14,7 +14,7 @@ class GuidType extends StringType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getGuidTypeDeclarationSQL($fieldDeclaration); return $platform->getGuidTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -22,7 +22,7 @@ class GuidType extends StringType ...@@ -22,7 +22,7 @@ class GuidType extends StringType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::GUID; return Types::GUID;
} }
...@@ -30,7 +30,7 @@ class GuidType extends StringType ...@@ -30,7 +30,7 @@ class GuidType extends StringType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return ! $platform->hasNativeGuidType(); return ! $platform->hasNativeGuidType();
} }
......
...@@ -15,7 +15,7 @@ class IntegerType extends Type implements PhpIntegerMappingType ...@@ -15,7 +15,7 @@ class IntegerType extends Type implements PhpIntegerMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::INTEGER; return Types::INTEGER;
} }
...@@ -23,7 +23,7 @@ class IntegerType extends Type implements PhpIntegerMappingType ...@@ -23,7 +23,7 @@ class IntegerType extends Type implements PhpIntegerMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getIntegerTypeDeclarationSQL($fieldDeclaration); return $platform->getIntegerTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -39,7 +39,7 @@ class IntegerType extends Type implements PhpIntegerMappingType ...@@ -39,7 +39,7 @@ class IntegerType extends Type implements PhpIntegerMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getBindingType() public function getBindingType() : int
{ {
return ParameterType::INTEGER; return ParameterType::INTEGER;
} }
......
...@@ -23,7 +23,7 @@ class JsonType extends Type ...@@ -23,7 +23,7 @@ class JsonType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getJsonTypeDeclarationSQL($fieldDeclaration); return $platform->getJsonTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -71,7 +71,7 @@ class JsonType extends Type ...@@ -71,7 +71,7 @@ class JsonType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::JSON; return Types::JSON;
} }
...@@ -79,7 +79,7 @@ class JsonType extends Type ...@@ -79,7 +79,7 @@ class JsonType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return ! $platform->hasNativeJsonType(); return ! $platform->hasNativeJsonType();
} }
......
...@@ -21,7 +21,7 @@ class ObjectType extends Type ...@@ -21,7 +21,7 @@ class ObjectType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getClobTypeDeclarationSQL($fieldDeclaration); return $platform->getClobTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -59,7 +59,7 @@ class ObjectType extends Type ...@@ -59,7 +59,7 @@ class ObjectType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::OBJECT; return Types::OBJECT;
} }
...@@ -67,7 +67,7 @@ class ObjectType extends Type ...@@ -67,7 +67,7 @@ class ObjectType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return true; return true;
} }
......
...@@ -20,7 +20,7 @@ class SimpleArrayType extends Type ...@@ -20,7 +20,7 @@ class SimpleArrayType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getClobTypeDeclarationSQL($fieldDeclaration); return $platform->getClobTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -54,7 +54,7 @@ class SimpleArrayType extends Type ...@@ -54,7 +54,7 @@ class SimpleArrayType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::SIMPLE_ARRAY; return Types::SIMPLE_ARRAY;
} }
...@@ -62,7 +62,7 @@ class SimpleArrayType extends Type ...@@ -62,7 +62,7 @@ class SimpleArrayType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return true; return true;
} }
......
...@@ -15,7 +15,7 @@ class SmallIntType extends Type implements PhpIntegerMappingType ...@@ -15,7 +15,7 @@ class SmallIntType extends Type implements PhpIntegerMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::SMALLINT; return Types::SMALLINT;
} }
...@@ -23,7 +23,7 @@ class SmallIntType extends Type implements PhpIntegerMappingType ...@@ -23,7 +23,7 @@ class SmallIntType extends Type implements PhpIntegerMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getSmallIntTypeDeclarationSQL($fieldDeclaration); return $platform->getSmallIntTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -39,7 +39,7 @@ class SmallIntType extends Type implements PhpIntegerMappingType ...@@ -39,7 +39,7 @@ class SmallIntType extends Type implements PhpIntegerMappingType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getBindingType() public function getBindingType() : int
{ {
return ParameterType::INTEGER; return ParameterType::INTEGER;
} }
......
...@@ -14,7 +14,7 @@ class StringType extends Type ...@@ -14,7 +14,7 @@ class StringType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration); return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -22,7 +22,7 @@ class StringType extends Type ...@@ -22,7 +22,7 @@ class StringType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::STRING; return Types::STRING;
} }
......
...@@ -16,7 +16,7 @@ class TextType extends Type ...@@ -16,7 +16,7 @@ class TextType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getClobTypeDeclarationSQL($fieldDeclaration); return $platform->getClobTypeDeclarationSQL($fieldDeclaration);
} }
...@@ -32,7 +32,7 @@ class TextType extends Type ...@@ -32,7 +32,7 @@ class TextType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::TEXT; return Types::TEXT;
} }
......
...@@ -17,7 +17,7 @@ class TimeImmutableType extends TimeType ...@@ -17,7 +17,7 @@ class TimeImmutableType extends TimeType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::TIME_IMMUTABLE; return Types::TIME_IMMUTABLE;
} }
...@@ -67,7 +67,7 @@ class TimeImmutableType extends TimeType ...@@ -67,7 +67,7 @@ class TimeImmutableType extends TimeType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return true; return true;
} }
......
...@@ -18,7 +18,7 @@ class TimeType extends Type ...@@ -18,7 +18,7 @@ class TimeType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::TIME_MUTABLE; return Types::TIME_MUTABLE;
} }
...@@ -26,7 +26,7 @@ class TimeType extends Type ...@@ -26,7 +26,7 @@ class TimeType extends Type
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return $platform->getTimeTypeDeclarationSQL($fieldDeclaration); return $platform->getTimeTypeDeclarationSQL($fieldDeclaration);
} }
......
...@@ -160,21 +160,17 @@ abstract class Type ...@@ -160,21 +160,17 @@ abstract class Type
/** /**
* Gets the SQL declaration snippet for a field of this type. * Gets the SQL declaration snippet for a field of this type.
* *
* @param mixed[] $fieldDeclaration The field declaration. * @param array<string, mixed> $fieldDeclaration The field declaration.
* @param AbstractPlatform $platform The currently used database platform. * @param AbstractPlatform $platform The currently used database platform.
*
* @return string
*/ */
abstract public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform); abstract public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string;
/** /**
* Gets the name of this type. * Gets the name of this type.
* *
* @return string
*
* @todo Needed? * @todo Needed?
*/ */
abstract public function getName(); abstract public function getName() : string;
/** /**
* @internal This method is only to be used within DBAL for forward compatibility purposes. Do not use directly. * @internal This method is only to be used within DBAL for forward compatibility purposes. Do not use directly.
...@@ -205,11 +201,9 @@ abstract class Type ...@@ -205,11 +201,9 @@ abstract class Type
* *
* @param string $name The name of the type (as returned by getName()). * @param string $name The name of the type (as returned by getName()).
* *
* @return \Doctrine\DBAL\Types\Type
*
* @throws DBALException * @throws DBALException
*/ */
public static function getType($name) public static function getType(string $name) : self
{ {
return self::getTypeRegistry()->get($name); return self::getTypeRegistry()->get($name);
} }
...@@ -220,11 +214,9 @@ abstract class Type ...@@ -220,11 +214,9 @@ abstract class Type
* @param string $name The name of the type. This should correspond to what getName() returns. * @param string $name The name of the type. This should correspond to what getName() returns.
* @param string $className The class name of the custom type. * @param string $className The class name of the custom type.
* *
* @return void
*
* @throws DBALException * @throws DBALException
*/ */
public static function addType($name, $className) public static function addType(string $name, string $className) : void
{ {
self::getTypeRegistry()->register($name, new $className()); self::getTypeRegistry()->register($name, new $className());
} }
...@@ -236,7 +228,7 @@ abstract class Type ...@@ -236,7 +228,7 @@ abstract class Type
* *
* @return bool TRUE if type is supported; FALSE otherwise. * @return bool TRUE if type is supported; FALSE otherwise.
*/ */
public static function hasType($name) public static function hasType(string $name) : bool
{ {
return self::getTypeRegistry()->has($name); return self::getTypeRegistry()->has($name);
} }
...@@ -244,14 +236,9 @@ abstract class Type ...@@ -244,14 +236,9 @@ abstract class Type
/** /**
* Overrides an already defined type to use a different implementation. * Overrides an already defined type to use a different implementation.
* *
* @param string $name
* @param string $className
*
* @return void
*
* @throws DBALException * @throws DBALException
*/ */
public static function overrideType($name, $className) public static function overrideType(string $name, string $className) : void
{ {
self::getTypeRegistry()->override($name, new $className()); self::getTypeRegistry()->override($name, new $className());
} }
...@@ -261,10 +248,8 @@ abstract class Type ...@@ -261,10 +248,8 @@ abstract class Type
* can be used when binding parameters to prepared statements. * can be used when binding parameters to prepared statements.
* *
* This method should return one of the {@link \Doctrine\DBAL\ParameterType} constants. * This method should return one of the {@link \Doctrine\DBAL\ParameterType} constants.
*
* @return int
*/ */
public function getBindingType() public function getBindingType() : int
{ {
return ParameterType::STRING; return ParameterType::STRING;
} }
...@@ -273,9 +258,9 @@ abstract class Type ...@@ -273,9 +258,9 @@ abstract class Type
* Gets the types array map which holds all registered types and the corresponding * Gets the types array map which holds all registered types and the corresponding
* type class * type class
* *
* @return string[] * @return array<string, string>
*/ */
public static function getTypesMap() public static function getTypesMap() : array
{ {
return array_map( return array_map(
static function (Type $type) : string { static function (Type $type) : string {
...@@ -292,35 +277,24 @@ abstract class Type ...@@ -292,35 +277,24 @@ abstract class Type
* Usage of {@link convertToDatabaseValueSQL} and * Usage of {@link convertToDatabaseValueSQL} and
* {@link convertToPHPValueSQL} works for any type and mostly * {@link convertToPHPValueSQL} works for any type and mostly
* does nothing. This method can additionally be used for optimization purposes. * does nothing. This method can additionally be used for optimization purposes.
*
* @return bool
*/ */
public function canRequireSQLConversion() public function canRequireSQLConversion() : bool
{ {
return false; return false;
} }
/** /**
* Modifies the SQL expression (identifier, parameter) to convert to a database value. * Modifies the SQL expression (identifier, parameter) to convert to a database value.
*
* @param string $sqlExpr
*
* @return string
*/ */
public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform) public function convertToDatabaseValueSQL(string $sqlExpr, AbstractPlatform $platform) : string
{ {
return $sqlExpr; return $sqlExpr;
} }
/** /**
* Modifies the SQL expression (identifier, parameter) to convert to a PHP value. * Modifies the SQL expression (identifier, parameter) to convert to a PHP value.
*
* @param string $sqlExpr
* @param AbstractPlatform $platform
*
* @return string
*/ */
public function convertToPHPValueSQL($sqlExpr, $platform) public function convertToPHPValueSQL(string $sqlExpr, AbstractPlatform $platform) : string
{ {
return $sqlExpr; return $sqlExpr;
} }
...@@ -328,9 +302,9 @@ abstract class Type ...@@ -328,9 +302,9 @@ abstract class Type
/** /**
* Gets an array of database types that map to this Doctrine type. * Gets an array of database types that map to this Doctrine type.
* *
* @return string[] * @return array<int, string>
*/ */
public function getMappedDatabaseTypes(AbstractPlatform $platform) public function getMappedDatabaseTypes(AbstractPlatform $platform) : array
{ {
return []; return [];
} }
...@@ -340,10 +314,8 @@ abstract class Type ...@@ -340,10 +314,8 @@ abstract class Type
* reverse schema engineering can't tell them apart. You need to mark * reverse schema engineering can't tell them apart. You need to mark
* one of those types as commented, which will have Doctrine use an SQL * one of those types as commented, which will have Doctrine use an SQL
* comment to typehint the actual Doctrine Type. * comment to typehint the actual Doctrine Type.
*
* @return bool
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return false; return false;
} }
......
...@@ -21,7 +21,11 @@ use function in_array; ...@@ -21,7 +21,11 @@ use function in_array;
*/ */
final class TypeRegistry 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 = []; private $instances = [];
/** /**
......
...@@ -18,7 +18,7 @@ class VarDateTimeImmutableType extends VarDateTimeType ...@@ -18,7 +18,7 @@ class VarDateTimeImmutableType extends VarDateTimeType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return Types::DATETIME_IMMUTABLE; return Types::DATETIME_IMMUTABLE;
} }
...@@ -64,7 +64,7 @@ class VarDateTimeImmutableType extends VarDateTimeType ...@@ -64,7 +64,7 @@ class VarDateTimeImmutableType extends VarDateTimeType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return true; return true;
} }
......
...@@ -525,7 +525,7 @@ class MoneyType extends Type ...@@ -525,7 +525,7 @@ class MoneyType extends Type
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getName() public function getName() : string
{ {
return 'MyMoney'; return 'MyMoney';
} }
...@@ -533,7 +533,7 @@ class MoneyType extends Type ...@@ -533,7 +533,7 @@ class MoneyType extends Type
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return 'MyMoney'; return 'MyMoney';
} }
......
...@@ -13,7 +13,7 @@ class CommentedType extends Type ...@@ -13,7 +13,7 @@ class CommentedType extends Type
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getName() public function getName() : string
{ {
return 'my_commented'; return 'my_commented';
} }
...@@ -21,7 +21,7 @@ class CommentedType extends Type ...@@ -21,7 +21,7 @@ class CommentedType extends Type
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return strtoupper($this->getName()); return strtoupper($this->getName());
} }
...@@ -29,7 +29,7 @@ class CommentedType extends Type ...@@ -29,7 +29,7 @@ class CommentedType extends Type
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
{ {
return true; return true;
} }
......
...@@ -13,7 +13,7 @@ class MySqlPointType extends Type ...@@ -13,7 +13,7 @@ class MySqlPointType extends Type
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getName() public function getName() : string
{ {
return 'point'; return 'point';
} }
...@@ -21,7 +21,7 @@ class MySqlPointType extends Type ...@@ -21,7 +21,7 @@ class MySqlPointType extends Type
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
{ {
return strtoupper($this->getName()); return strtoupper($this->getName());
} }
...@@ -29,7 +29,7 @@ class MySqlPointType extends Type ...@@ -29,7 +29,7 @@ class MySqlPointType extends Type
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getMappedDatabaseTypes(AbstractPlatform $platform) public function getMappedDatabaseTypes(AbstractPlatform $platform) : array
{ {
return ['point']; return ['point'];
} }
......
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