Skip to content

Commit

Permalink
Change property Schema::$typeMap to constant Schema::TYPE_MAP (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov authored Nov 16, 2023
1 parent cb2d47a commit 5276702
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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') {
Expand Down

0 comments on commit 5276702

Please sign in to comment.