Skip to content

Commit 2de610c

Browse files
authored
Merge pull request msyk#111 from matsuo/reduce-errors-detected-by-phpstan
Reduce "Cannot access property" errors detected by PHPStan
2 parents b289a90 + 3f6cf32 commit 2de610c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Supporting/FileMakerRelation.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function getDataInfo(): object|array|null
107107
*/
108108
public function getTargetTable(): null|string
109109
{
110-
return ($this->dataInfo) ? $this->dataInfo->table : null;
110+
return $this->dataInfo->table ?? null;
111111
}
112112

113113
/**
@@ -118,8 +118,7 @@ public function getTargetTable(): null|string
118118
*/
119119
public function getTotalCount(): null|int
120120
{
121-
return ($this->dataInfo && property_exists($this->dataInfo, 'totalRecordCount')) ?
122-
$this->dataInfo->totalRecordCount : null;
121+
return $this->dataInfo->totalRecordCount ?? null;
123122
}
124123

125124
/**
@@ -131,7 +130,7 @@ public function getTotalCount(): null|int
131130
*/
132131
public function getFoundCount(): null|int
133132
{
134-
return ($this->dataInfo) ? $this->dataInfo->foundCount : null;
133+
return $this->dataInfo->foundCount ?? null;
135134
}
136135

137136
/**
@@ -143,7 +142,7 @@ public function getFoundCount(): null|int
143142
*/
144143
public function getReturnedCount(): null|int
145144
{
146-
return ($this->dataInfo) ? $this->dataInfo->returnedCount : null;
145+
return $this->dataInfo->returnedCount ?? null;
147146
}
148147

149148
/**

0 commit comments

Comments
 (0)