Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Aug 17, 2020
1 parent 595cce1 commit bbc57b3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Form/DoctrineOrmTypeGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ public function guessType($class, $property)
case self::$useDeprecatedConstants ? Type::BOOLEAN : Types::BOOLEAN:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::HIGH_CONFIDENCE);
case self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE:
// no break
case self::$useDeprecatedConstants ? Type::DATETIMETZ : Types::DATETIMETZ_MUTABLE:
// no break
case 'vardatetime':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', [], Guess::HIGH_CONFIDENCE);
case 'dateinterval':
Expand All @@ -79,10 +81,13 @@ public function guessType($class, $property)
case self::$useDeprecatedConstants ? Type::TIME : Types::TIME_MUTABLE:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', [], Guess::HIGH_CONFIDENCE);
case self::$useDeprecatedConstants ? Type::DECIMAL : Types::DECIMAL:
// no break
case self::$useDeprecatedConstants ? Type::FLOAT : Types::FLOAT:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', [], Guess::MEDIUM_CONFIDENCE);
case self::$useDeprecatedConstants ? Type::INTEGER : Types::INTEGER:
// no break
case self::$useDeprecatedConstants ? Type::BIGINT : Types::BIGINT:
// no break
case self::$useDeprecatedConstants ? Type::SMALLINT : Types::SMALLINT:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\IntegerType', [], Guess::MEDIUM_CONFIDENCE);
case self::$useDeprecatedConstants ? Type::STRING : Types::STRING:
Expand Down
17 changes: 17 additions & 0 deletions PropertyInfo/DoctrineExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,11 @@ public function getTypes($class, $property, array $context = [])
case Type::BUILTIN_TYPE_OBJECT:
switch ($typeOfField) {
case self::$useDeprecatedConstants ? DBALType::DATE : Types::DATE_MUTABLE:
// no break
case self::$useDeprecatedConstants ? DBALType::DATETIME : Types::DATETIME_MUTABLE:
// no break
case self::$useDeprecatedConstants ? DBALType::DATETIMETZ : Types::DATETIMETZ_MUTABLE:
// no break
case 'vardatetime':
case self::$useDeprecatedConstants ? DBALType::TIME : Types::TIME_MUTABLE:
return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTime')];
Expand All @@ -177,6 +180,7 @@ public function getTypes($class, $property, array $context = [])
case Type::BUILTIN_TYPE_ARRAY:
switch ($typeOfField) {
case self::$useDeprecatedConstants ? DBALType::TARRAY : 'array':
// no break
case 'json_array':
return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];

Expand Down Expand Up @@ -229,32 +233,43 @@ private function getPhpType($doctrineType)
{
switch ($doctrineType) {
case self::$useDeprecatedConstants ? DBALType::SMALLINT : Types::SMALLINT:
// no break
case self::$useDeprecatedConstants ? DBALType::INTEGER : Types::INTEGER:
return Type::BUILTIN_TYPE_INT;

case self::$useDeprecatedConstants ? DBALType::FLOAT : Types::FLOAT:
return Type::BUILTIN_TYPE_FLOAT;

case self::$useDeprecatedConstants ? DBALType::BIGINT : Types::BIGINT:
// no break
case self::$useDeprecatedConstants ? DBALType::STRING : Types::STRING:
// no break
case self::$useDeprecatedConstants ? DBALType::TEXT : Types::TEXT:
// no break
case self::$useDeprecatedConstants ? DBALType::GUID : Types::GUID:
// no break
case self::$useDeprecatedConstants ? DBALType::DECIMAL : Types::DECIMAL:
return Type::BUILTIN_TYPE_STRING;

case self::$useDeprecatedConstants ? DBALType::BOOLEAN : Types::BOOLEAN:
return Type::BUILTIN_TYPE_BOOL;

case self::$useDeprecatedConstants ? DBALType::BLOB : Types::BLOB:
// no break
case 'binary':
return Type::BUILTIN_TYPE_RESOURCE;

case self::$useDeprecatedConstants ? DBALType::OBJECT : Types::OBJECT:
// no break
case self::$useDeprecatedConstants ? DBALType::DATE : Types::DATE_MUTABLE:
// no break
case self::$useDeprecatedConstants ? DBALType::DATETIME : Types::DATETIME_MUTABLE:
// no break
case self::$useDeprecatedConstants ? DBALType::DATETIMETZ : Types::DATETIMETZ_MUTABLE:
// no break
case 'vardatetime':
case self::$useDeprecatedConstants ? DBALType::TIME : Types::TIME_MUTABLE:
// no break
case 'date_immutable':
case 'datetime_immutable':
case 'datetimetz_immutable':
Expand All @@ -263,7 +278,9 @@ private function getPhpType($doctrineType)
return Type::BUILTIN_TYPE_OBJECT;

case self::$useDeprecatedConstants ? DBALType::TARRAY : 'array':
// no break
case self::$useDeprecatedConstants ? DBALType::SIMPLE_ARRAY : Types::SIMPLE_ARRAY:
// no break
case 'json_array':
return Type::BUILTIN_TYPE_ARRAY;
}
Expand Down

0 comments on commit bbc57b3

Please sign in to comment.