From 52767023a0a2717887e50c5c8c6b33f69958c78d Mon Sep 17 00:00:00 2001 From: Sergei Tigrov Date: Thu, 16 Nov 2023 13:10:12 +0700 Subject: [PATCH] Change property `Schema::$typeMap` to constant `Schema::TYPE_MAP` (#286) --- CHANGELOG.md | 2 +- src/Schema.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d780854..d3b68110 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 1.1.1 under development -- no changes in this release. +- Enh #286: Change property `Schema::$typeMap` to constant `Schema::TYPE_MAP` (@Tigrov) ## 1.1.0 November 12, 2023 diff --git a/src/Schema.php b/src/Schema.php index 1d9bfcde..0da2199b 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -63,11 +63,11 @@ final class Schema extends AbstractPdoSchema protected string|null $defaultSchema = 'dbo'; /** - * @var array Mapping from physical column types (keys) to abstract column types (values). + * Mapping from physical column types (keys) to abstract column types (values). * - * @psalm-var string[] + * @var string[] */ - private array $typeMap = [ + private const TYPE_MAP = [ /** Exact numbers */ 'bigint' => self::TYPE_BIGINT, 'numeric' => self::TYPE_DECIMAL, @@ -440,8 +440,8 @@ protected function loadColumnSchema(array $info): ColumnSchemaInterface if (preg_match('/^(\w+)(?:\(([^)]+)\))?/', $dbType, $matches)) { $type = $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 ($type === 'bit') {