Skip to content

Commit f996d3e

Browse files
authored
Merge pull request #117: Add hints for ULID and snowflake column types
2 parents 35890d8 + 1946184 commit f996d3e

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
],
3939
"require": {
4040
"php": ">=8.1",
41+
"cycle/database": "^2.15",
4142
"cycle/orm": "^2.9.2",
4243
"cycle/schema-builder": "^2.11.1",
4344
"spiral/attributes": "^2.8|^3.0",

src/Annotation/Column.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(
5151
#[ExpectedValues(values: ['primary', 'bigPrimary', 'enum', 'boolean',
5252
'integer', 'tinyInteger', 'smallInteger', 'bigInteger', 'string', 'text', 'tinyText', 'longText', 'double',
5353
'float', 'decimal', 'datetime', 'date', 'time', 'timestamp', 'binary', 'tinyBinary', 'longBinary', 'json',
54-
'uuid', 'bit',
54+
'snowflake', 'ulid', 'uuid', 'bit',
5555
// PostgreSQL
5656
'smallPrimary', 'timetz', 'timestamptz', 'interval', 'bitVarying', 'int4range', 'int8range', 'numrange',
5757
'tsrange', 'tstzrange', 'daterange', 'jsonb', 'point', 'line', 'lseg', 'box', 'path', 'polygon', 'circle',

tests/Annotated/Fixtures/Fixtures26/City.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ private function __construct(string $value)
1313
$this->value = $value;
1414
}
1515

16-
public function __toString(): string
16+
public static function fromString(string $value): self
1717
{
18-
return $this->value;
18+
return new self($value);
1919
}
2020

21-
public static function fromString(string $value): self
21+
public function __toString(): string
2222
{
23-
return new self($value);
23+
return $this->value;
2424
}
2525
}

tests/Annotated/Fixtures/Fixtures26/CityTypecast.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function uncast(array $data): array
4343
continue;
4444
}
4545

46-
$data[$column] = (string)$value;
46+
$data[$column] = (string) $value;
4747
}
4848

4949
return $data;

0 commit comments

Comments
 (0)