From d21a9ac30a49d6dcd0a903f9248b0f84e7a7f880 Mon Sep 17 00:00:00 2001 From: Sergei Tigrov Date: Fri, 9 Aug 2024 19:05:31 +0700 Subject: [PATCH] Refactor column PHP type (#354) Co-authored-by: StyleCI Bot --- CHANGELOG.md | 1 + src/Column/ArrayColumnSchema.php | 36 ++++++++++-------- src/Column/StructuredColumnSchema.php | 10 +++-- src/Schema.php | 45 +++++++++-------------- tests/ColumnSchemaTest.php | 2 +- tests/Provider/ColumnSchemaProvider.php | 39 ++++++++++---------- tests/Provider/SchemaProvider.php | 38 +++++++++---------- tests/Provider/StructuredTypeProvider.php | 14 +++---- 8 files changed, 94 insertions(+), 91 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f24370fb..9e920564 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Enh #349: Add method chaining for column classes (@Tigrov) - Enh #350: Add array overlaps and JSON overlaps condition builders (@Tigrov) - Enh #353: Update `bit` type according to main PR yiisoft/db#860 (@Tigrov) +- Enh #354: Refactor PHP type of `ColumnSchemaInterface` instances (@Tigrov) ## 1.3.0 March 21, 2024 diff --git a/src/Column/ArrayColumnSchema.php b/src/Column/ArrayColumnSchema.php index 789dbf8b..0507c4a5 100644 --- a/src/Column/ArrayColumnSchema.php +++ b/src/Column/ArrayColumnSchema.php @@ -5,6 +5,7 @@ namespace Yiisoft\Db\Pgsql\Column; use Traversable; +use Yiisoft\Db\Constant\PhpType; use Yiisoft\Db\Expression\ArrayExpression; use Yiisoft\Db\Expression\ExpressionInterface; use Yiisoft\Db\Pgsql\ArrayParser; @@ -37,9 +38,8 @@ final class ArrayColumnSchema extends AbstractColumnSchema public function __construct( string $type = Schema::TYPE_ARRAY, - string|null $phpType = SchemaInterface::PHP_TYPE_ARRAY, ) { - parent::__construct($type, $phpType); + parent::__construct($type); } /** @@ -58,22 +58,23 @@ public function getColumn(): ColumnSchemaInterface { if ($this->column === null) { $type = $this->getType(); - $phpType = $this->getPhpType(); $this->column = match ($type) { - SchemaInterface::TYPE_BIT => new BitColumnSchema($type, $phpType), - Schema::TYPE_STRUCTURED => new StructuredColumnSchema($type, $phpType), + SchemaInterface::TYPE_BOOLEAN => new BooleanColumnSchema($type), + SchemaInterface::TYPE_BIT => new BitColumnSchema($type), + SchemaInterface::TYPE_TINYINT => new IntegerColumnSchema($type), + SchemaInterface::TYPE_SMALLINT => new IntegerColumnSchema($type), + SchemaInterface::TYPE_INTEGER => new IntegerColumnSchema($type), SchemaInterface::TYPE_BIGINT => PHP_INT_SIZE !== 8 - ? new BigIntColumnSchema($type, $phpType) - : new IntegerColumnSchema($type, $phpType), - default => match ($phpType) { - SchemaInterface::PHP_TYPE_INTEGER => new IntegerColumnSchema($type, $phpType), - SchemaInterface::PHP_TYPE_DOUBLE => new DoubleColumnSchema($type, $phpType), - SchemaInterface::PHP_TYPE_BOOLEAN => new BooleanColumnSchema($type, $phpType), - SchemaInterface::PHP_TYPE_RESOURCE => new BinaryColumnSchema($type, $phpType), - SchemaInterface::PHP_TYPE_ARRAY => new JsonColumnSchema($type, $phpType), - default => new StringColumnSchema($type, $phpType), - }, + ? new BigIntColumnSchema($type) + : new IntegerColumnSchema($type), + SchemaInterface::TYPE_DECIMAL => new DoubleColumnSchema($type), + SchemaInterface::TYPE_FLOAT => new DoubleColumnSchema($type), + SchemaInterface::TYPE_DOUBLE => new DoubleColumnSchema($type), + SchemaInterface::TYPE_BINARY => new BinaryColumnSchema($type), + SchemaInterface::TYPE_JSON => new JsonColumnSchema($type), + Schema::TYPE_STRUCTURED => new StructuredColumnSchema($type), + default => new StringColumnSchema($type), }; $this->column->dbType($this->getDbType()); @@ -103,6 +104,11 @@ public function getDimension(): int return $this->dimension; } + public function getPhpType(): string + { + return PhpType::ARRAY; + } + public function dbTypecast(mixed $value): ExpressionInterface|null { if ($value === null || $value instanceof ExpressionInterface) { diff --git a/src/Column/StructuredColumnSchema.php b/src/Column/StructuredColumnSchema.php index fac6ded9..263514ef 100644 --- a/src/Column/StructuredColumnSchema.php +++ b/src/Column/StructuredColumnSchema.php @@ -5,13 +5,13 @@ namespace Yiisoft\Db\Pgsql\Column; use Traversable; +use Yiisoft\Db\Constant\PhpType; use Yiisoft\Db\Expression\ExpressionInterface; use Yiisoft\Db\Pgsql\Schema; use Yiisoft\Db\Pgsql\StructuredExpression; use Yiisoft\Db\Pgsql\StructuredParser; use Yiisoft\Db\Schema\Column\AbstractColumnSchema; use Yiisoft\Db\Schema\Column\ColumnSchemaInterface; -use Yiisoft\Db\Schema\SchemaInterface; use function array_keys; use function is_iterable; @@ -28,9 +28,8 @@ final class StructuredColumnSchema extends AbstractColumnSchema implements Struc public function __construct( string $type = Schema::TYPE_STRUCTURED, - string|null $phpType = SchemaInterface::PHP_TYPE_ARRAY, ) { - parent::__construct($type, $phpType); + parent::__construct($type); } public function columns(array $columns): static @@ -44,6 +43,11 @@ public function getColumns(): array return $this->columns; } + public function getPhpType(): string + { + return PhpType::ARRAY; + } + public function dbTypecast(mixed $value): mixed { if ($value === null || $value instanceof ExpressionInterface) { diff --git a/src/Schema.php b/src/Schema.php index ae8c1a42..1d093355 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -28,7 +28,6 @@ use Yiisoft\Db\Pgsql\Column\StructuredColumnSchemaInterface; use Yiisoft\Db\Schema\Builder\ColumnInterface; use Yiisoft\Db\Schema\Column\ColumnSchemaInterface; -use Yiisoft\Db\Schema\Column\StringColumnSchema; use Yiisoft\Db\Schema\SchemaInterface; use Yiisoft\Db\Schema\TableSchemaInterface; @@ -876,25 +875,20 @@ private function loadColumnSchema(array $info): ColumnSchemaInterface return $column; } - protected function getColumnPhpType(string $type, bool $isUnsigned = false): string + protected function createColumnSchemaFromType(string $type, bool $isUnsigned = false): ColumnSchemaInterface { return match ($type) { - self::TYPE_BIT => self::PHP_TYPE_INTEGER, - self::TYPE_STRUCTURED => self::PHP_TYPE_ARRAY, - default => parent::getColumnPhpType($type, $isUnsigned), - }; - } - - protected function createColumnSchemaFromPhpType(string $phpType, string $type): ColumnSchemaInterface - { - return match ($phpType) { - self::PHP_TYPE_STRING => $type === SchemaInterface::TYPE_BIGINT - ? new BigIntColumnSchema($type, $phpType) - : new StringColumnSchema($type, $phpType), - self::PHP_TYPE_INTEGER => new IntegerColumnSchema($type, $phpType), - self::PHP_TYPE_BOOLEAN => new BooleanColumnSchema($type, $phpType), - self::PHP_TYPE_RESOURCE => new BinaryColumnSchema($type, $phpType), - default => parent::createColumnSchemaFromPhpType($phpType, $type), + SchemaInterface::TYPE_BOOLEAN => new BooleanColumnSchema($type), + SchemaInterface::TYPE_BIT => new BitColumnSchema($type), + SchemaInterface::TYPE_TINYINT => new IntegerColumnSchema($type), + SchemaInterface::TYPE_SMALLINT => new IntegerColumnSchema($type), + SchemaInterface::TYPE_INTEGER => new IntegerColumnSchema($type), + SchemaInterface::TYPE_BIGINT => PHP_INT_SIZE !== 8 + ? new BigIntColumnSchema($type) + : new IntegerColumnSchema($type), + SchemaInterface::TYPE_BINARY => new BinaryColumnSchema($type), + self::TYPE_STRUCTURED => new StructuredColumnSchema($type), + default => parent::createColumnSchemaFromType($type), }; } @@ -1092,16 +1086,13 @@ protected function createColumnSchema(string $type, mixed ...$info): ColumnSchem return $column; } - $phpType = $this->getColumnPhpType($type); + $column = $this->createColumnSchemaFromType($type); - return match ($type) { - self::TYPE_BIT => new BitColumnSchema($type, $phpType), - self::TYPE_STRUCTURED => (new StructuredColumnSchema($type, $phpType))->columns($info['columns'] ?? []), - self::TYPE_BIGINT => PHP_INT_SIZE !== 8 - ? new BigIntColumnSchema($type, $phpType) - : new IntegerColumnSchema($type, $phpType), - default => parent::createColumnSchema($type), - }; + if ($column instanceof StructuredColumnSchemaInterface) { + $column->columns($info['columns'] ?? []); + } + + return $column; } /** diff --git a/tests/ColumnSchemaTest.php b/tests/ColumnSchemaTest.php index 5f290e1f..d5c3901e 100644 --- a/tests/ColumnSchemaTest.php +++ b/tests/ColumnSchemaTest.php @@ -385,7 +385,7 @@ public function testArrayColumnSchema() public function testArrayColumnSchemaColumn(): void { - $arrayCol = new ArrayColumnSchema(SchemaInterface::TYPE_STRING, SchemaInterface::PHP_TYPE_STRING); + $arrayCol = new ArrayColumnSchema(SchemaInterface::TYPE_STRING); $intCol = new IntegerColumnSchema(); $this->assertInstanceOf(StringColumnSchema::class, $arrayCol->getColumn()); diff --git a/tests/Provider/ColumnSchemaProvider.php b/tests/Provider/ColumnSchemaProvider.php index 855acd53..319041b3 100644 --- a/tests/Provider/ColumnSchemaProvider.php +++ b/tests/Provider/ColumnSchemaProvider.php @@ -6,6 +6,7 @@ use PDO; use Yiisoft\Db\Command\Param; +use Yiisoft\Db\Constant\PhpType; use Yiisoft\Db\Expression\Expression; use Yiisoft\Db\Expression\JsonExpression; use Yiisoft\Db\Pgsql\Column\BigIntColumnSchema; @@ -28,7 +29,7 @@ public static function predefinedTypes(): array $values['bigint'][0] = BigIntColumnSchema::class; $values['binary'][0] = BinaryColumnSchema::class; $values['boolean'][0] = BooleanColumnSchema::class; - $values['bit'] = [BitColumnSchema::class, Schema::TYPE_BIT, SchemaInterface::PHP_TYPE_INTEGER]; + $values['bit'][0] = BitColumnSchema::class; return $values; } @@ -97,7 +98,7 @@ public static function dbTypecastArrayColumns() [ 'int4', SchemaInterface::TYPE_INTEGER, - SchemaInterface::PHP_TYPE_INTEGER, + PhpType::INT, [ // [dimension, expected, typecast value] [1, [1, 2, 3, null], [1, 2.0, '3', null]], @@ -108,7 +109,7 @@ public static function dbTypecastArrayColumns() [ 'int8', SchemaInterface::TYPE_BIGINT, - SchemaInterface::PHP_TYPE_INTEGER, + PhpType::INT, [ [1, [1, 2, 3, $bigInt], [1, 2.0, '3', '9223372036854775807']], [2, [[1, 2], [3], [$bigInt]], [[1, 2.0], ['3'], ['9223372036854775807']]], @@ -117,7 +118,7 @@ public static function dbTypecastArrayColumns() [ 'float8', SchemaInterface::TYPE_DOUBLE, - SchemaInterface::PHP_TYPE_DOUBLE, + PhpType::FLOAT, [ [1, [1.0, 2.2, 3.3, null], [1, 2.2, '3.3', null]], [2, [[1.0, 2.2], [3.3, null]], [[1, 2.2], ['3.3', null]]], @@ -126,7 +127,7 @@ public static function dbTypecastArrayColumns() [ 'bool', SchemaInterface::TYPE_BOOLEAN, - SchemaInterface::PHP_TYPE_BOOLEAN, + PhpType::BOOL, [ [1, [true, true, true, false, false, false, null], [true, 1, '1', false, 0, '0', null]], [2, [[true, true, true, false, false, false, null]], [[true, 1, '1', false, 0, '0', null]]], @@ -135,7 +136,7 @@ public static function dbTypecastArrayColumns() [ 'varchar', SchemaInterface::TYPE_STRING, - SchemaInterface::PHP_TYPE_STRING, + PhpType::STRING, [ [1, ['1', '2', '1', '0', '', null], [1, '2', true, false, '', null]], [2, [['1', '2', '1', '0'], [''], [null]], [[1, '2', true, false], [''], [null]]], @@ -144,7 +145,7 @@ public static function dbTypecastArrayColumns() [ 'bytea', SchemaInterface::TYPE_BINARY, - SchemaInterface::PHP_TYPE_RESOURCE, + PhpType::MIXED, [ [1, [ '1', @@ -163,7 +164,7 @@ public static function dbTypecastArrayColumns() [ 'jsonb', SchemaInterface::TYPE_JSON, - SchemaInterface::PHP_TYPE_ARRAY, + PhpType::MIXED, [ [1, [ new JsonExpression([1, 2, 3], 'jsonb'), @@ -185,7 +186,7 @@ public static function dbTypecastArrayColumns() [ 'varbit', Schema::TYPE_BIT, - SchemaInterface::PHP_TYPE_INTEGER, + PhpType::INT, [ [1, ['1011', '1001', null], [0b1011, '1001', null]], [2, [['1011', '1001', null]], [[0b1011, '1001', null]]], @@ -194,7 +195,7 @@ public static function dbTypecastArrayColumns() [ 'price_composite', Schema::TYPE_STRUCTURED, - SchemaInterface::PHP_TYPE_ARRAY, + PhpType::ARRAY, [ [ 1, @@ -232,7 +233,7 @@ public static function phpTypecastArrayColumns() [ 'int4', SchemaInterface::TYPE_INTEGER, - SchemaInterface::PHP_TYPE_INTEGER, + PhpType::INT, [ // [dimension, expected, typecast value] [1, [1, 2, 3, null], '{1,2,3,}'], @@ -242,7 +243,7 @@ public static function phpTypecastArrayColumns() [ 'int8', SchemaInterface::TYPE_BIGINT, - SchemaInterface::PHP_TYPE_INTEGER, + PhpType::INT, [ [1, [1, 2, $bigInt], '{1,2,9223372036854775807}'], [2, [[1, 2], [$bigInt]], '{{1,2},{9223372036854775807}}'], @@ -251,7 +252,7 @@ public static function phpTypecastArrayColumns() [ 'float8', SchemaInterface::TYPE_DOUBLE, - SchemaInterface::PHP_TYPE_DOUBLE, + PhpType::FLOAT, [ [1, [1.0, 2.2, null], '{1,2.2,}'], [2, [[1.0], [2.2, null]], '{{1},{2.2,}}'], @@ -260,7 +261,7 @@ public static function phpTypecastArrayColumns() [ 'bool', SchemaInterface::TYPE_BOOLEAN, - SchemaInterface::PHP_TYPE_BOOLEAN, + PhpType::BOOL, [ [1, [true, false, null], '{t,f,}'], [2, [[true, false, null]], '{{t,f,}}'], @@ -269,7 +270,7 @@ public static function phpTypecastArrayColumns() [ 'varchar', SchemaInterface::TYPE_STRING, - SchemaInterface::PHP_TYPE_STRING, + PhpType::STRING, [ [1, ['1', '2', '', null], '{1,2,"",}'], [2, [['1', '2'], [''], [null]], '{{1,2},{""},{NULL}}'], @@ -278,7 +279,7 @@ public static function phpTypecastArrayColumns() [ 'bytea', SchemaInterface::TYPE_BINARY, - SchemaInterface::PHP_TYPE_RESOURCE, + PhpType::MIXED, [ [1, ["\x10\x11", '', null], '{\x1011,"",}'], [2, [["\x10\x11"], ['', null]], '{{\x1011},{"",}}'], @@ -287,7 +288,7 @@ public static function phpTypecastArrayColumns() [ 'jsonb', SchemaInterface::TYPE_JSON, - SchemaInterface::PHP_TYPE_ARRAY, + PhpType::MIXED, [ [1, [[1, 2, 3], null], '{"[1,2,3]",}'], [1, [[1, 2, 3]], '{{1,2,3}}'], @@ -297,7 +298,7 @@ public static function phpTypecastArrayColumns() [ 'varbit', Schema::TYPE_BIT, - SchemaInterface::PHP_TYPE_INTEGER, + PhpType::INT, [ [1, [0b1011, 0b1001, null], '{1011,1001,}'], [2, [[0b1011, 0b1001, null]], '{{1011,1001,}}'], @@ -306,7 +307,7 @@ public static function phpTypecastArrayColumns() [ 'price_structured', Schema::TYPE_STRUCTURED, - SchemaInterface::PHP_TYPE_ARRAY, + PhpType::ARRAY, [ [1, [['10', 'USD'], null], '{"(10,USD)",}'], [2, [[['10', 'USD'], null]], '{{"(10,USD)",}}'], diff --git a/tests/Provider/SchemaProvider.php b/tests/Provider/SchemaProvider.php index db7b9fc4..ed3b63ac 100644 --- a/tests/Provider/SchemaProvider.php +++ b/tests/Provider/SchemaProvider.php @@ -16,7 +16,7 @@ public static function columns(): array 'int_col' => [ 'type' => 'integer', 'dbType' => 'int4', - 'phpType' => 'integer', + 'phpType' => 'int', 'primaryKey' => false, 'allowNull' => false, 'autoIncrement' => false, @@ -29,7 +29,7 @@ public static function columns(): array 'int_col2' => [ 'type' => 'integer', 'dbType' => 'int4', - 'phpType' => 'integer', + 'phpType' => 'int', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -42,7 +42,7 @@ public static function columns(): array 'tinyint_col' => [ 'type' => 'smallint', 'dbType' => 'int2', - 'phpType' => 'integer', + 'phpType' => 'int', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -55,7 +55,7 @@ public static function columns(): array 'smallint_col' => [ 'type' => 'smallint', 'dbType' => 'int2', - 'phpType' => 'integer', + 'phpType' => 'int', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -120,7 +120,7 @@ public static function columns(): array 'float_col' => [ 'type' => 'double', 'dbType' => 'float8', - 'phpType' => 'double', + 'phpType' => 'float', 'primaryKey' => false, 'allowNull' => false, 'autoIncrement' => false, @@ -133,7 +133,7 @@ public static function columns(): array 'float_col2' => [ 'type' => 'double', 'dbType' => 'float8', - 'phpType' => 'double', + 'phpType' => 'float', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -146,7 +146,7 @@ public static function columns(): array 'blob_col' => [ 'type' => 'binary', 'dbType' => 'bytea', - 'phpType' => 'resource', + 'phpType' => 'mixed', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -159,7 +159,7 @@ public static function columns(): array 'numeric_col' => [ 'type' => 'decimal', 'dbType' => 'numeric', - 'phpType' => 'double', + 'phpType' => 'float', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -185,7 +185,7 @@ public static function columns(): array 'bool_col' => [ 'type' => 'boolean', 'dbType' => 'bool', - 'phpType' => 'boolean', + 'phpType' => 'bool', 'primaryKey' => false, 'allowNull' => false, 'autoIncrement' => false, @@ -198,7 +198,7 @@ public static function columns(): array 'bool_col2' => [ 'type' => 'boolean', 'dbType' => 'bool', - 'phpType' => 'boolean', + 'phpType' => 'bool', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -224,7 +224,7 @@ public static function columns(): array 'bit_col' => [ 'type' => 'bit', 'dbType' => 'bit', - 'phpType' => 'integer', + 'phpType' => 'int', 'primaryKey' => false, 'allowNull' => false, 'autoIncrement' => false, @@ -237,7 +237,7 @@ public static function columns(): array 'varbit_col' => [ 'type' => 'bit', 'dbType' => 'varbit', - 'phpType' => 'integer', + 'phpType' => 'int', 'primaryKey' => false, 'allowNull' => false, 'autoIncrement' => false, @@ -250,7 +250,7 @@ public static function columns(): array 'bigint_col' => [ 'type' => 'bigint', 'dbType' => 'int8', - 'phpType' => 'integer', + 'phpType' => 'int', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -276,7 +276,7 @@ public static function columns(): array 'column' => [ 'type' => 'integer', 'dbType' => 'int4', - 'phpType' => 'integer', + 'phpType' => 'int', 'enumValues' => null, 'size' => null, 'precision' => 32, @@ -299,7 +299,7 @@ public static function columns(): array 'column' => [ 'type' => 'decimal', 'dbType' => 'numeric', - 'phpType' => 'double', + 'phpType' => 'float', 'enumValues' => null, 'size' => null, 'precision' => 5, @@ -355,7 +355,7 @@ public static function columns(): array 'json_col' => [ 'type' => 'json', 'dbType' => 'json', - 'phpType' => 'array', + 'phpType' => 'mixed', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -368,7 +368,7 @@ public static function columns(): array 'jsonb_col' => [ 'type' => 'json', 'dbType' => 'jsonb', - 'phpType' => 'array', + 'phpType' => 'mixed', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -394,7 +394,7 @@ public static function columns(): array 'column' => [ 'type' => 'json', 'dbType' => 'json', - 'phpType' => 'array', + 'phpType' => 'mixed', 'enumValues' => null, 'size' => null, 'precision' => null, @@ -409,7 +409,7 @@ public static function columns(): array 'id' => [ 'type' => 'integer', 'dbType' => 'int4', - 'phpType' => 'integer', + 'phpType' => 'int', 'primaryKey' => true, 'allowNull' => false, 'autoIncrement' => true, diff --git a/tests/Provider/StructuredTypeProvider.php b/tests/Provider/StructuredTypeProvider.php index 3238335e..f3c191cd 100644 --- a/tests/Provider/StructuredTypeProvider.php +++ b/tests/Provider/StructuredTypeProvider.php @@ -18,7 +18,7 @@ public static function columns(): array 'id' => [ 'type' => 'integer', 'dbType' => 'int4', - 'phpType' => 'integer', + 'phpType' => 'int', 'primaryKey' => true, 'allowNull' => false, 'autoIncrement' => true, @@ -44,7 +44,7 @@ public static function columns(): array 'value' => [ 'type' => 'decimal', 'dbType' => 'numeric', - 'phpType' => 'double', + 'phpType' => 'float', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -85,7 +85,7 @@ public static function columns(): array 'value' => [ 'type' => 'decimal', 'dbType' => 'numeric', - 'phpType' => 'double', + 'phpType' => 'float', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -131,7 +131,7 @@ public static function columns(): array 'value' => [ 'type' => 'decimal', 'dbType' => 'numeric', - 'phpType' => 'double', + 'phpType' => 'float', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -173,7 +173,7 @@ public static function columns(): array 'value' => [ 'type' => 'decimal', 'dbType' => 'numeric', - 'phpType' => 'double', + 'phpType' => 'float', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -230,7 +230,7 @@ public static function columns(): array 'value' => [ 'type' => 'decimal', 'dbType' => 'numeric', - 'phpType' => 'double', + 'phpType' => 'float', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false, @@ -271,7 +271,7 @@ public static function columns(): array 'value' => [ 'type' => 'decimal', 'dbType' => 'numeric', - 'phpType' => 'double', + 'phpType' => 'float', 'primaryKey' => false, 'allowNull' => true, 'autoIncrement' => false,