Skip to content

Commit

Permalink
Merge pull request #1 from MathisBurger/entity-default-value
Browse files Browse the repository at this point in the history
Fixed pipeline errors
  • Loading branch information
MathisBurger authored Nov 19, 2024
2 parents b561073 + 68724a4 commit 46412e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/DefaultValueValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ public static function validateBoolean(mixed $value): bool
if (\in_array($value, ['true', 'false'])) {
return 'true' === $value;
}
throw new RuntimeCommandException(sprintf('Value %s is invalid for type boolean', $value));
throw new RuntimeCommandException(\sprintf('Value %s is invalid for type boolean', $value));
}

public static function validateFloat(mixed $value): float
{
if (is_numeric($value)) {
return (float) $value;
}
throw new RuntimeCommandException(sprintf('Value %s is invalid for type float', $value));
throw new RuntimeCommandException(\sprintf('Value %s is invalid for type float', $value));
}

public static function validateInt(mixed $value): int
Expand All @@ -81,6 +81,6 @@ public static function validateInt(mixed $value): int
return $val;
}
}
throw new RuntimeCommandException(sprintf('Value %s is invalid for type int', $value));
throw new RuntimeCommandException(\sprintf('Value %s is invalid for type int', $value));
}
}
4 changes: 2 additions & 2 deletions src/Util/ClassSource/Model/ClassProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static function createFromObject(FieldMapping|array $data): self
precision: $data->precision,
scale: $data->scale,
unique: $data->unique ?? false,
defaultValue: $data->defaultValue ?? null
defaultValue: $data->defaultValue ?? null,
enumType: $data->enumType,
);
}
Expand All @@ -101,7 +101,7 @@ enumType: $data->enumType,
precision: $data['precision'] ?? null,
scale: $data['scale'] ?? null,
unique: $data['unique'] ?? false,
defaultValue: $data['defaultValue'] ?? null
defaultValue: $data['defaultValue'] ?? null,
enumType: $data['enumType'] ?? null,
);
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Maker/MakeEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,8 @@ public function getTestDetails(): \Generator
'',
// nullable
'y',
// no default value
'',
// finish adding fields
'',
]);
Expand Down

0 comments on commit 46412e3

Please sign in to comment.