diff --git a/psalm.xml b/psalm.xml index 8bb4c4c..6461f99 100644 --- a/psalm.xml +++ b/psalm.xml @@ -5,6 +5,7 @@ findUnusedBaselineEntry="true" findUnusedCode="false" resolveFromConfigFile="true" + strictBinaryOperands="false" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" diff --git a/src/Column/ColumnDefinitionParser.php b/src/Column/ColumnDefinitionParser.php index e1f0055..6aefed1 100644 --- a/src/Column/ColumnDefinitionParser.php +++ b/src/Column/ColumnDefinitionParser.php @@ -29,7 +29,9 @@ public function parse(string $definition): array { preg_match(self::TYPE_PATTERN, $definition, $matches); - $type = strtolower(preg_replace('/\s*\(\d+\)/', '', $matches[4] ?? $matches[1])); + /** @var string $type */ + $type = preg_replace('/\s*\(\d+\)/', '', $matches[4] ?? $matches[1]); + $type = strtolower($type); $info = ['type' => $type]; $typeDetails = $matches[6] ?? $matches[2] ?? ''; diff --git a/src/Column/JsonColumn.php b/src/Column/JsonColumn.php index e779777..b6387a9 100644 --- a/src/Column/JsonColumn.php +++ b/src/Column/JsonColumn.php @@ -28,7 +28,9 @@ public function phpTypecast(mixed $value): mixed } if (is_resource($value)) { - return json_decode(stream_get_contents($value), true, 512, JSON_THROW_ON_ERROR); + /** @var string */ + $value = stream_get_contents($value); + return json_decode($value, true, 512, JSON_THROW_ON_ERROR); } return $value; diff --git a/src/Schema.php b/src/Schema.php index 0fa001c..3b3f945 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -446,7 +446,9 @@ protected function getTableSequenceName(string $tableName): string|null */ private function loadColumn(array $info): ColumnInterface { - $dbType = strtolower(preg_replace('/\([^)]+\)/', '', $info['data_type'])); + /** @var string $dbType */ + $dbType = preg_replace('/\([^)]+\)/', '', $info['data_type']); + $dbType = strtolower($dbType); match ($dbType) { 'timestamp',