From 3f6cf32567081f09e480d1de491691178e28b808 Mon Sep 17 00:00:00 2001 From: Atsushi Matsuo Date: Sun, 24 Nov 2024 09:29:47 +0900 Subject: [PATCH] Reduce "Cannot access property" errors detected by PHPStan --- src/Supporting/FileMakerRelation.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Supporting/FileMakerRelation.php b/src/Supporting/FileMakerRelation.php index 54687d1..4f6ace1 100644 --- a/src/Supporting/FileMakerRelation.php +++ b/src/Supporting/FileMakerRelation.php @@ -107,7 +107,7 @@ public function getDataInfo(): object|array|null */ public function getTargetTable(): null|string { - return ($this->dataInfo) ? $this->dataInfo->table : null; + return $this->dataInfo->table ?? null; } /** @@ -118,8 +118,7 @@ public function getTargetTable(): null|string */ public function getTotalCount(): null|int { - return ($this->dataInfo && property_exists($this->dataInfo, 'totalRecordCount')) ? - $this->dataInfo->totalRecordCount : null; + return $this->dataInfo->totalRecordCount ?? null; } /** @@ -131,7 +130,7 @@ public function getTotalCount(): null|int */ public function getFoundCount(): null|int { - return ($this->dataInfo) ? $this->dataInfo->foundCount : null; + return $this->dataInfo->foundCount ?? null; } /** @@ -143,7 +142,7 @@ public function getFoundCount(): null|int */ public function getReturnedCount(): null|int { - return ($this->dataInfo) ? $this->dataInfo->returnedCount : null; + return $this->dataInfo->returnedCount ?? null; } /**