From b0c817ddb3e72db99680888c27f128d395bcf07e Mon Sep 17 00:00:00 2001 From: Tigrov Date: Thu, 16 Nov 2023 09:22:04 +0700 Subject: [PATCH 1/3] Change `$typeMap` to constant --- src/Schema.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Schema.php b/src/Schema.php index 4861d3de5..6d4d7745e 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -87,13 +87,13 @@ final class Schema extends AbstractPdoSchema public const TYPE_BIT = 'bit'; /** - * @var array The mapping from physical column types (keys) to abstract column types (values). + * The mapping from physical column types (keys) to abstract column types (values). * * @link https://www.postgresql.org/docs/current/static/datatype.html#DATATYPE-TABLE * - * @psalm-var string[] + * @var string[] */ - private array $typeMap = [ + private const TYPE_MAP = [ 'bit' => self::TYPE_BIT, 'bit varying' => self::TYPE_BIT, 'varbit' => self::TYPE_BIT, @@ -807,7 +807,7 @@ protected function loadColumnSchema(array $info): ColumnSchemaInterface $column->sequenceName($this->resolveTableName($info['sequence_name'])->getFullName()); } - $column->type($this->typeMap[(string) $column->getDbType()] ?? self::TYPE_STRING); + $column->type(self::TYPE_MAP[(string) $column->getDbType()] ?? self::TYPE_STRING); $column->phpType($this->getColumnPhpType($column)); $column->defaultValue($this->normalizeDefaultValue($defaultValue, $column)); From b86d2f58bfe38e4c1e4609570bfa59aa8c7d02dd Mon Sep 17 00:00:00 2001 From: Tigrov Date: Thu, 16 Nov 2023 09:24:08 +0700 Subject: [PATCH 2/3] Update link --- src/Schema.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Schema.php b/src/Schema.php index 6d4d7745e..dfa355fa6 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -89,7 +89,7 @@ final class Schema extends AbstractPdoSchema /** * The mapping from physical column types (keys) to abstract column types (values). * - * @link https://www.postgresql.org/docs/current/static/datatype.html#DATATYPE-TABLE + * @link https://www.postgresql.org/docs/current/datatype.html#DATATYPE-TABLE * * @var string[] */ From a8579fdd7ec4a3e2bfda64632e2d5ebf4b967a54 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Thu, 16 Nov 2023 09:35:12 +0700 Subject: [PATCH 3/3] Add line to CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ab4b252b..d763da096 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 1.2.1 under development -- no changes in this release. +- Enh #324: Change property `Schema::$typeMap` to constant `Schema::TYPE_MAP` (@Tigrov) ## 1.2.0 November 12, 2023