From d71caf0c75e324c6e4740dd9a32497c0efa8e843 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 21 Apr 2021 13:54:37 +0200 Subject: [PATCH] Row: fixed ?? usage --- src/Dibi/Row.php | 6 ++++++ tests/dibi/Row.phpt | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/Dibi/Row.php b/src/Dibi/Row.php index ff57523..f367fd4 100644 --- a/src/Dibi/Row.php +++ b/src/Dibi/Row.php @@ -53,6 +53,12 @@ class Row implements \ArrayAccess, \IteratorAggregate, \Countable } + public function __isset(string $key): bool + { + return false; + } + + /********************* interfaces ArrayAccess, Countable & IteratorAggregate ****************d*g**/ diff --git a/tests/dibi/Row.phpt b/tests/dibi/Row.phpt index bcf79bd..8728721 100644 --- a/tests/dibi/Row.phpt +++ b/tests/dibi/Row.phpt @@ -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) {