Skip to content

Commit

Permalink
Row: fixed ?? usage
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Apr 21, 2021
1 parent 3066fea commit d71caf0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Dibi/Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public function __get(string $key)
}


public function __isset(string $key): bool
{
return false;
}


/********************* interfaces ArrayAccess, Countable & IteratorAggregate ****************d*g**/


Expand Down
4 changes: 4 additions & 0 deletions tests/dibi/Row.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ Assert::error(function () use ($row) {
Assert::false(isset($row->missing));
Assert::false(isset($row['missing']));

// ??
Assert::same(123, $row->missing ?? 123);
Assert::same(123, $row['missing'] ?? 123);


// suggestions
Assert::error(function () use ($row) {
Expand Down

0 comments on commit d71caf0

Please # to comment.