-
Notifications
You must be signed in to change notification settings - Fork 1
/
DateTime.php
43 lines (38 loc) · 921 Bytes
/
DateTime.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace ICanBoogie\ActiveRecord\Schema;
use Attribute;
#[Attribute(Attribute::TARGET_PROPERTY)]
final readonly class DateTime extends Column
{
public const NOW = 'NOW';
public const CURRENT_TIMESTAMP = 'CURRENT_TIMESTAMP';
/**
* @param array{
* null: bool,
* default: ?non-empty-string,
* unique: bool,
* } $an_array
*/
public static function __set_state(array $an_array): self
{
return new self(
$an_array['null'],
$an_array['default'],
$an_array['unique'],
);
}
/**
* @param non-empty-string|null $default
*/
public function __construct(
bool $null = false,
?string $default = null,
bool $unique = false,
) {
parent::__construct(
null: $null,
default: $default,
unique: $unique,
);
}
}