From 748ba871ae4da82a230429c22fc86e4f74029f9b Mon Sep 17 00:00:00 2001 From: Tigrov Date: Thu, 16 Nov 2023 10:09:37 +0700 Subject: [PATCH 1/2] Change property `Schema::$typeMap` to constant `Schema::TYPE_MAP` --- src/Schema.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Schema.php b/src/Schema.php index 57134f1a..cc88fcd4 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -72,9 +72,11 @@ final class Schema extends AbstractPdoSchema { /** - * @var string[] Mapping from physical column types (keys) to abstract column types (values). + * Mapping from physical column types (keys) to abstract column types (values). + * + * @var string[] */ - private array $typeMap = [ + private const TYPE_MAP = [ 'tinyint' => self::TYPE_TINYINT, 'bit' => self::TYPE_SMALLINT, 'boolean' => self::TYPE_BOOLEAN, @@ -481,8 +483,8 @@ protected function loadColumnSchema(array $info): ColumnSchemaInterface if (preg_match('/^(\w+)(?:\(([^)]+)\))?/', $column->getDbType() ?? '', $matches)) { $type = strtolower($matches[1]); - if (isset($this->typeMap[$type])) { - $column->type($this->typeMap[$type]); + if (isset(self::TYPE_MAP[$type])) { + $column->type(self::TYPE_MAP[$type]); } if (!empty($matches[2])) { From ed6f03e3658ca4fbec8d3eca53439f4d468e450e Mon Sep 17 00:00:00 2001 From: Tigrov Date: Thu, 16 Nov 2023 10:12:16 +0700 Subject: [PATCH 2/2] Add line to CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99610dd1..24aa252d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 1.1.1 under development - Enh #281: Remove unused code in `Command` class (@vjik) +- Enh #282: Change property `Schema::$typeMap` to constant `Schema::TYPE_MAP` (@Tigrov) ## 1.1.0 November 12, 2023