Skip to content

Commit 555abc1

Browse files
felixuref3l1x
authored andcommitted
Code: fix PHPStan errors in DatabaseAnalyser
1 parent e7c8b53 commit 555abc1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/Analyser/Database/DatabaseAnalyser.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,14 @@ protected function analyseColumns(Table $table): void
6666
$column->setName($col['name']);
6767
$column->setNullable($col['nullable']);
6868
$column->setType(Helpers::columnType($col['nativetype']));
69-
$column->setDefault($col['default']);
69+
$column->setDefault(is_scalar($col['default']) ? (string) $col['default'] : null);
7070
$column->setOnUpdate(str_contains($col['vendor']['extra'] ?? $col['vendor']['Extra'] ?? '', 'on update'));
7171

7272
// Analyse ENUM
7373
if ($col['nativetype'] === ColumnTypes::NATIVE_TYPE_ENUM) {
74+
/** @var array<int, array<int, string>> $enum */
7475
$enum = Strings::matchAll($col['vendor']['type'] ?? $col['vendor']['Type'], ColumnTypes::NATIVE_REGEX_ENUM, PREG_PATTERN_ORDER);
75-
if ($enum !== []) {
76+
if (isset($enum[1])) {
7677
$column->setEnum($enum[1]);
7778
$column->setType(ColumnTypes::TYPE_ENUM);
7879
$column->setSubtype(Helpers::columnType($col['nativetype']));

0 commit comments

Comments
 (0)