Skip to content

Commit

Permalink
Fix psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Mar 10, 2025
1 parent 0178eb5 commit a19e0fa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion src/Column/ColumnDefinitionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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] ?? '';
Expand Down
4 changes: 3 additions & 1 deletion src/Column/JsonColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit a19e0fa

Please sign in to comment.