Skip to content

Commit

Permalink
Check if matches are empty strings, not if they exist
Browse files Browse the repository at this point in the history
Fix phpstan error.
  • Loading branch information
rizwanjiwan committed Sep 17, 2024
1 parent 2951a74 commit 43dfc68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Propel/Generator/Reverse/MysqlSchemaParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function getColumnFromRow(array $row, Table $table): Column
$/x';
if (preg_match($regexp, $row['Type'], $matches)) {
$nativeType = $matches[1];
if ($matches[2]) {
if (empty($matches[2])===false) {

Check failure on line 240 in src/Propel/Generator/Reverse/MysqlSchemaParser.php

View workflow job for this annotation

GitHub Actions / code-style-and-static-analysis

Offset 2 on array{string, non-empty-string, non-falsy-string, string, string, 'UNSIGNED…'} in empty() always exists and is not falsy.
$cpos = strpos($matches[2], ',');
if ($cpos !== false) {
$size = (int)substr($matches[2], 0, $cpos);
Expand All @@ -246,7 +246,7 @@ public function getColumnFromRow(array $row, Table $table): Column
$size = (int)$matches[2];
}
}
if ($matches[3]) {
if (empty($matches[3])===false) {
$sqlType = $row['Type'];
}
if (isset(static::$defaultTypeSizes[$nativeType]) && $scale == null && $size === static::$defaultTypeSizes[$nativeType]) {
Expand Down

0 comments on commit 43dfc68

Please sign in to comment.