From 925205ed59a2612ba4eae7cb92e4e2aac4fc4ed7 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Mon, 8 Oct 2018 10:50:54 +1100 Subject: [PATCH] Remove exception that can never happen Because of type hinting in the constructor the spreadsheet object can never be null anymore. --- src/PhpSpreadsheet/Writer/Html.php | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/src/PhpSpreadsheet/Writer/Html.php b/src/PhpSpreadsheet/Writer/Html.php index f46905ec..8cd026d3 100644 --- a/src/PhpSpreadsheet/Writer/Html.php +++ b/src/PhpSpreadsheet/Writer/Html.php @@ -344,11 +344,6 @@ class Html extends BaseWriter */ public function generateHTMLHeader($pIncludeStyles = false) { - // Spreadsheet object known? - if ($this->spreadsheet === null) { - throw new WriterException('Internal Spreadsheet object not set to an instance of an object.'); - } - // Construct HTML $properties = $this->spreadsheet->getProperties(); $html = '' . PHP_EOL; @@ -404,11 +399,6 @@ class Html extends BaseWriter */ public function generateSheetData() { - // Spreadsheet object known? - if ($this->spreadsheet === null) { - throw new WriterException('Internal Spreadsheet object not set to an instance of an object.'); - } - // Ensure that Spans have been calculated? if ($this->sheetIndex !== null || !$this->spansAreCalculated) { $this->calculateSpans(); @@ -525,11 +515,6 @@ class Html extends BaseWriter */ public function generateNavigation() { - // Spreadsheet object known? - if ($this->spreadsheet === null) { - throw new WriterException('Internal Spreadsheet object not set to an instance of an object.'); - } - // Fetch sheets $sheets = []; if ($this->sheetIndex === null) { @@ -756,11 +741,6 @@ class Html extends BaseWriter */ public function generateStyles($generateSurroundingHTML = true) { - // Spreadsheet object known? - if ($this->spreadsheet === null) { - throw new WriterException('Internal Spreadsheet object not set to an instance of an object.'); - } - // Build CSS $css = $this->buildCSS($generateSurroundingHTML); @@ -800,11 +780,6 @@ class Html extends BaseWriter */ public function buildCSS($generateSurroundingHTML = true) { - // Spreadsheet object known? - if ($this->spreadsheet === null) { - throw new WriterException('Internal Spreadsheet object not set to an instance of an object.'); - } - // Cached? if ($this->cssStyles !== null) { return $this->cssStyles;