Skip to content

Commit a66ad6e

Browse files
author
Greg Bowler
committed
Document getNullableType
1 parent 25c1f51 commit a66ad6e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ Common areas you will see this interface used:
1717
+ Database rows
1818
+ User input (from the query string or posted form data)
1919
+ Session and cookie storage
20-
+ [DataObject](https://github.com/PhpGt/DataObject)
20+
+ [DataObject](https://github.com/PhpGt/DataObject)
21+
22+
`NullableTypeSafeGetter` trait
23+
------------------------------
24+
25+
A lot of repositories within PHP.Gt that utilise this class were repeating the same getter code, so this trait was introduced to remove the repetition. All getter functions of the interface are implemented, introducing a protected helper function `getNullableType` which removes the repetition of checking null values before casting them. The `getNullableType` function also allows a callback to be passed as the type parameter, allowing more complex nullable types to be constructed.

0 commit comments

Comments
 (0)