Skip to content

Commit

Permalink
Merge pull request #1991 from InvisibleSmiley/fix-sqliteadapter-stati…
Browse files Browse the repository at this point in the history
…c-access

Access static fields statically
  • Loading branch information
dereuromark committed Jun 17, 2021
2 parents f46f760 + ff444ce commit 26adc41
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Phinx/Db/Adapter/SQLiteAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1401,9 +1401,9 @@ public function getSqlType($type, $limit = null)
$typeLC = strtolower($type);
if ($type instanceof Literal) {
$name = $type;
} elseif (isset(self::$supportedColumnTypes[$typeLC])) {
$name = self::$supportedColumnTypes[$typeLC];
} elseif (in_array($typeLC, self::$unsupportedColumnTypes, true)) {
} elseif (isset(static::$supportedColumnTypes[$typeLC])) {
$name = static::$supportedColumnTypes[$typeLC];
} elseif (in_array($typeLC, static::$unsupportedColumnTypes, true)) {
throw new UnsupportedColumnTypeException('Column type "' . $type . '" is not supported by SQLite.');
} else {
throw new UnsupportedColumnTypeException('Column type "' . $type . '" is not known by SQLite.');
Expand Down Expand Up @@ -1439,13 +1439,13 @@ public function getPhinxType($sqlTypeDef)
// the type is a MySQL-style boolean
$name = static::PHINX_TYPE_BOOLEAN;
$limit = null;
} elseif (isset(self::$supportedColumnTypes[$typeLC])) {
} elseif (isset(static::$supportedColumnTypes[$typeLC])) {
// the type is an explicitly supported type
$name = $typeLC;
} elseif (isset(self::$supportedColumnTypeAliases[$typeLC])) {
} elseif (isset(static::$supportedColumnTypeAliases[$typeLC])) {
// the type is an alias for a supported type
$name = self::$supportedColumnTypeAliases[$typeLC];
} elseif (in_array($typeLC, self::$unsupportedColumnTypes, true)) {
$name = static::$supportedColumnTypeAliases[$typeLC];
} elseif (in_array($typeLC, static::$unsupportedColumnTypes, true)) {
// unsupported but known types are passed through lowercased, and without appended affinity
$name = Literal::from($typeLC);
} else {
Expand Down
1 change: 1 addition & 0 deletions tests/Phinx/Db/Adapter/SQLiteAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,7 @@ public function testDumpCreateTableAndThenInsert()
INSERT INTO `table1` (`column1`, `column2`) VALUES ('id1', 1);
OUTPUT;
$actualOutput = $consoleOutput->fetch();
$actualOutput = preg_replace("/\r\n|\r/", "\n", $actualOutput); // normalize line endings for Windows
$this->assertStringContainsString($expectedOutput, $actualOutput, 'Passing the --dry-run option does not dump create and then insert table queries to the output');
}

Expand Down

0 comments on commit 26adc41

Please sign in to comment.