Skip to content

Commit fd45a0b

Browse files
authored
Change property Schema::$typeMap to constant Schema::TYPE_MAP (#282)
1 parent e3d9164 commit fd45a0b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 1.1.1 under development
44

55
- Enh #281: Remove unused code in `Command` class (@vjik)
6+
- Enh #282: Change property `Schema::$typeMap` to constant `Schema::TYPE_MAP` (@Tigrov)
67

78
## 1.1.0 November 12, 2023
89

src/Schema.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@
7272
final class Schema extends AbstractPdoSchema
7373
{
7474
/**
75-
* @var string[] Mapping from physical column types (keys) to abstract column types (values).
75+
* Mapping from physical column types (keys) to abstract column types (values).
76+
*
77+
* @var string[]
7678
*/
77-
private array $typeMap = [
79+
private const TYPE_MAP = [
7880
'tinyint' => self::TYPE_TINYINT,
7981
'bit' => self::TYPE_SMALLINT,
8082
'boolean' => self::TYPE_BOOLEAN,
@@ -481,8 +483,8 @@ protected function loadColumnSchema(array $info): ColumnSchemaInterface
481483
if (preg_match('/^(\w+)(?:\(([^)]+)\))?/', $column->getDbType() ?? '', $matches)) {
482484
$type = strtolower($matches[1]);
483485

484-
if (isset($this->typeMap[$type])) {
485-
$column->type($this->typeMap[$type]);
486+
if (isset(self::TYPE_MAP[$type])) {
487+
$column->type(self::TYPE_MAP[$type]);
486488
}
487489

488490
if (!empty($matches[2])) {

0 commit comments

Comments
 (0)