Skip to content

Commit

Permalink
Use null coalescing operator when possible
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Feb 28, 2020
1 parent 00fcc8f commit 0cc8618
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ShapeFile.php
Expand Up @@ -401,7 +401,7 @@ private function loadHeaders()
private function saveBBoxRecord($file, $type)
{
fwrite($file, Util::packDouble(
isset($this->boundingBox[$type]) ? $this->boundingBox[$type] : 0
$this->boundingBox[$type] ?? 0
));
}

Expand Down
6 changes: 3 additions & 3 deletions src/ShapeRecord.php
Expand Up @@ -215,7 +215,7 @@ public function updateDBFInfo($header)
unset($this->dbfData);
$this->dbfData = [];
foreach ($header as $value) {
$this->dbfData[$value[0]] = (isset($tmp[$value[0]])) ? $tmp[$value[0]] : '';
$this->dbfData[$value[0]] = $tmp[$value[0]] ?? '';
}
}

Expand Down Expand Up @@ -685,14 +685,14 @@ public function addPoint($point, $partIndex = 0)
//Adds a new point to the selected part
$this->shpData['parts'][$partIndex]['points'][] = $point;
$this->shpData['numparts'] = count($this->shpData['parts']);
$this->shpData['numpoints'] = 1 + (isset($this->shpData['numpoints']) ? $this->shpData['numpoints'] : 0);
$this->shpData['numpoints'] = 1 + ($this->shpData['numpoints'] ?? 0);
break;
case 8:
case 18:
case 28:
//Adds a new point
$this->shpData['points'][] = $point;
$this->shpData['numpoints'] = 1 + (isset($this->shpData['numpoints']) ? $this->shpData['numpoints'] : 0);
$this->shpData['numpoints'] = 1 + ($this->shpData['numpoints'] ?? 0);
break;
default:
$this->setError(sprintf('The Shape Type "%s" is not supported.', $this->shapeType));
Expand Down

0 comments on commit 0cc8618

Please sign in to comment.