Skip to content

Commit

Permalink
Allow nullable DateTime (#170)
Browse files Browse the repository at this point in the history
* Allow nullable DateTime

* Allow nullable data wherever a cast is made

* Update dependencies
  • Loading branch information
g105b authored Oct 31, 2019
1 parent d5ddbb9 commit 716a6b2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Result/Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ public function getString(string $columnName):?string {
}

public function getInt(string $columnName):?int {
return (int)$this->data[$columnName] ?? null;
return (int)($this->data[$columnName] ?? null);
}

public function getFloat(string $columnName):?float {
return (float)$this->data[$columnName] ?? null;
return (float)($this->data[$columnName] ?? null);
}

public function getBool(string $columnName):?bool {
return (bool)$this->data[$columnName] ?? null;
return (bool)($this->data[$columnName] ?? null);
}

public function getDateTime(string $columnName):?DateTime {
$dateString = $this->data[$columnName];
$dateString = $this->data[$columnName] ?? null;
if(is_null($dateString)) {
return null;
}
Expand Down Expand Up @@ -78,7 +78,7 @@ public function rewind():void {
public function key():?string {
return $this->iterator_data_key_list[
$this->iterator_index
] ?? null;
] ?? null;
}

public function next():void {
Expand All @@ -88,7 +88,7 @@ public function next():void {
public function valid():bool {
return isset($this->iterator_data_key_list[
$this->iterator_index
]);
]);
}

public function current():?string {
Expand Down

0 comments on commit 716a6b2

Please sign in to comment.