Skip to content

Commit a19e0fa

Browse files
committed
Fix psalm
1 parent 0178eb5 commit a19e0fa

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
findUnusedBaselineEntry="true"
66
findUnusedCode="false"
77
resolveFromConfigFile="true"
8+
strictBinaryOperands="false"
89
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
910
xmlns="https://getpsalm.org/schema/config"
1011
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"

src/Column/ColumnDefinitionParser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public function parse(string $definition): array
2929
{
3030
preg_match(self::TYPE_PATTERN, $definition, $matches);
3131

32-
$type = strtolower(preg_replace('/\s*\(\d+\)/', '', $matches[4] ?? $matches[1]));
32+
/** @var string $type */
33+
$type = preg_replace('/\s*\(\d+\)/', '', $matches[4] ?? $matches[1]);
34+
$type = strtolower($type);
3335
$info = ['type' => $type];
3436

3537
$typeDetails = $matches[6] ?? $matches[2] ?? '';

src/Column/JsonColumn.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public function phpTypecast(mixed $value): mixed
2828
}
2929

3030
if (is_resource($value)) {
31-
return json_decode(stream_get_contents($value), true, 512, JSON_THROW_ON_ERROR);
31+
/** @var string */
32+
$value = stream_get_contents($value);
33+
return json_decode($value, true, 512, JSON_THROW_ON_ERROR);
3234
}
3335

3436
return $value;

src/Schema.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,9 @@ protected function getTableSequenceName(string $tableName): string|null
446446
*/
447447
private function loadColumn(array $info): ColumnInterface
448448
{
449-
$dbType = strtolower(preg_replace('/\([^)]+\)/', '', $info['data_type']));
449+
/** @var string $dbType */
450+
$dbType = preg_replace('/\([^)]+\)/', '', $info['data_type']);
451+
$dbType = strtolower($dbType);
450452

451453
match ($dbType) {
452454
'timestamp',

0 commit comments

Comments
 (0)