Skip to content

Commit

Permalink
Reduce "Cannot access property" errors detected by PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
matsuo committed Nov 24, 2024
1 parent b289a90 commit 3f6cf32
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Supporting/FileMakerRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -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;
}

/**
Expand All @@ -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;
}

/**
Expand All @@ -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;
}

/**
Expand Down

0 comments on commit 3f6cf32

Please sign in to comment.