From a4c8c3ae1df57111408eea08a682a966dc08e7ca Mon Sep 17 00:00:00 2001 From: Joey Smith Date: Sun, 11 Jan 2026 23:58:38 -0600 Subject: [PATCH 1/2] Simply the __get method body Signed-off-by: Joey Smith Signed-off-by: Joey Smith --- src/TableGateway/AbstractTableGateway.php | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/TableGateway/AbstractTableGateway.php b/src/TableGateway/AbstractTableGateway.php index 63bac1ec..0e1e0fb2 100644 --- a/src/TableGateway/AbstractTableGateway.php +++ b/src/TableGateway/AbstractTableGateway.php @@ -410,20 +410,15 @@ public function getLastInsertValue(): int */ public function __get(string $property): mixed { - try { - return match ($property) { - 'lastInsertValue', 'adapter', 'table' => $this->$property, - default => throw new Exception\InvalidArgumentException(), - }; - } catch (Exception\InvalidArgumentException) { - if ($this->featureSet->canCallMagicGet($property)) { - return $this->featureSet->callMagicGet($property); - } - } - - throw new Exception\InvalidArgumentException( - 'Invalid magic property access in ' . self::class . '::__get()' - ); + return match (true) { + 'lastInsertValue' === $property, + 'adapter' === $property, + 'table' === $property => $this->$property, + $this->featureSet->canCallMagicGet($property) => $this->featureSet->callMagicGet($property), + default => throw new Exception\InvalidArgumentException( + 'Invalid magic property access in ' . self::class . '::__get()' + ), + }; } /** From 545e7b44503c772d5e3e869cbdb3ed39721c50ed Mon Sep 17 00:00:00 2001 From: Joey Smith Date: Mon, 12 Jan 2026 00:03:44 -0600 Subject: [PATCH 2/2] Signed-off-by: Joey Smith --- src/TableGateway/AbstractTableGateway.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TableGateway/AbstractTableGateway.php b/src/TableGateway/AbstractTableGateway.php index 0e1e0fb2..80387a78 100644 --- a/src/TableGateway/AbstractTableGateway.php +++ b/src/TableGateway/AbstractTableGateway.php @@ -412,8 +412,8 @@ public function __get(string $property): mixed { return match (true) { 'lastInsertValue' === $property, - 'adapter' === $property, - 'table' === $property => $this->$property, + 'adapter' === $property, + 'table' === $property => $this->$property, $this->featureSet->canCallMagicGet($property) => $this->featureSet->callMagicGet($property), default => throw new Exception\InvalidArgumentException( 'Invalid magic property access in ' . self::class . '::__get()'