Drop $this->spreadSheet null check from Xlsx Writer (#1646)

$this->spreadSheet cannot be null
This commit is contained in:
Simon Podlipsky 2020-10-02 10:55:50 +02:00 committed by GitHub
parent 416e27b632
commit 3d9867ce95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 225 additions and 233 deletions

View File

@ -178,7 +178,6 @@ class Xlsx extends BaseWriter
*/ */
public function save($pFilename): void public function save($pFilename): void
{ {
if ($this->spreadSheet !== null) {
// garbage collect // garbage collect
$this->pathNames = []; $this->pathNames = [];
$this->spreadSheet->garbageCollect(); $this->spreadSheet->garbageCollect();
@ -407,9 +406,6 @@ class Xlsx extends BaseWriter
} }
$this->maybeCloseFileHandle(); $this->maybeCloseFileHandle();
} else {
throw new WriterException('PhpSpreadsheet object unassigned.');
}
} }
/** /**
@ -419,13 +415,9 @@ class Xlsx extends BaseWriter
*/ */
public function getSpreadsheet() public function getSpreadsheet()
{ {
if ($this->spreadSheet !== null) {
return $this->spreadSheet; return $this->spreadSheet;
} }
throw new WriterException('No Spreadsheet object assigned.');
}
/** /**
* Set Spreadsheet object. * Set Spreadsheet object.
* *