Skip to content

Commit

Permalink
Fix more PHPStan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Aug 28, 2024
1 parent a8777ff commit b9183ca
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Schema/SQLiteSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,22 @@ protected function _getPortableTableColumnList(string $table, string $database,
*/
protected function _getPortableTableColumnDefinition(array $tableColumn): Column
{
preg_match('/^([^()]*)\\s*(\\(((\\d+)(,\\s*(\\d+))?)\\))?/', $tableColumn['type'], $matches);
$matchResult = preg_match('/^([^()]*)\\s*(\\(((\\d+)(,\\s*(\\d+))?)\\))?/', $tableColumn['type'], $matches);
assert($matchResult === 1);

$dbType = trim(strtolower($matches[1]));

$length = $precision = $unsigned = null;
$length = $precision = null;
$fixed = $unsigned = false;
$scale = 0;

if (count($matches) >= 6) {
$precision = (int) $matches[4];
$scale = (int) $matches[6];
} elseif (count($matches) >= 4) {
$length = (int) $matches[4];
if (isset($matches[4])) {
if (isset($matches[6])) {
$precision = (int) $matches[4];
$scale = (int) $matches[6];
} else {
$length = (int) $matches[4];
}
}

if (str_contains($dbType, ' unsigned')) {
Expand Down

0 comments on commit b9183ca

Please sign in to comment.