Skip to content

Commit ed302b1

Browse files
author
Greg Bowler
authored
Merge pull request #1 from PhpGt/nullable-datetime
Allow nullable DateTimeInterface
2 parents 94fc71b + 629ad24 commit ed302b1

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Throughout PHP.Gt repositories, wherever an object represents enclosed data, a c
66
The following methods are defined by this interface:
77

88
+ `get(string $name):mixed` - A non-type-safe getter, used for getting keys that are not of an inbuilt type
9-
+ `getString(string $name):string`
10-
+ `getInt(string $name):int`
11-
+ `getFloat(string $name):float`
12-
+ `getBool(string $name):bool`
13-
+ `getDateTime(string $name):DateTimeInterface`
9+
+ `getString(string $name):?string`
10+
+ `getInt(string $name):?int`
11+
+ `getFloat(string $name):?float`
12+
+ `getBool(string $name):?bool`
13+
+ `getDateTime(string $name):?DateTimeInterface`
1414

1515
Common areas you will see this interface used:
1616

composer.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,23 @@
1212
"phpstan/phpstan": ">=0.12.42"
1313
},
1414

15-
"autoload": {
16-
"psr-4": {
17-
"Gt\\TypeSafeGetter\\": "./src"
18-
}
19-
},
20-
2115
"authors": [
2216
{
2317
"name": "Greg Bowler",
2418
"email": "greg.bowler@g105b.com"
2519
}
26-
]
20+
],
21+
22+
"funding": [
23+
{
24+
"type": "github",
25+
"url": "https://github.com/sponsors/PhpGt"
26+
}
27+
],
28+
29+
"autoload": {
30+
"psr-4": {
31+
"Gt\\TypeSafeGetter\\": "./src"
32+
}
33+
}
2734
}

src/TypeSafeGetter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ public function getString(string $name):?string;
99
public function getInt(string $name):?int;
1010
public function getFloat(string $name):?float;
1111
public function getBool(string $name):?bool;
12-
public function getDateTime(string $name):DateTimeInterface;
12+
public function getDateTime(string $name):?DateTimeInterface;
1313
}

0 commit comments

Comments
 (0)