diff --git a/src/TableGateway/AbstractTableGateway.php b/src/TableGateway/AbstractTableGateway.php index 63bac1ec..80387a78 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()' + ), + }; } /**