From d645ed92d57e9db0c38db9983cce43494c9a6e94 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Mon, 1 Jul 2019 20:59:34 +0200 Subject: [PATCH] Allow nullable theme for Xlsx Style Reader class (#1044) --- samples/Basic/16_Csv.php | 3 +++ samples/Basic/26_Utf8.php | 1 + src/PhpSpreadsheet/Reader/Security/XmlScanner.php | 7 ------- src/PhpSpreadsheet/Reader/Xlsx.php | 1 - src/PhpSpreadsheet/Reader/Xlsx/Styles.php | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/samples/Basic/16_Csv.php b/samples/Basic/16_Csv.php index ceb8b2f5c2..de753d565a 100644 --- a/samples/Basic/16_Csv.php +++ b/samples/Basic/16_Csv.php @@ -6,6 +6,7 @@ $spreadsheet = require __DIR__ . '/../templates/sampleSpreadsheet.php'; $helper->log('Write to CSV format'); +/** @var \PhpOffice\PhpSpreadsheet\Writer\Csv $writer */ $writer = IOFactory::createWriter($spreadsheet, 'Csv')->setDelimiter(',') ->setEnclosure('"') ->setSheetIndex(0); @@ -17,6 +18,7 @@ $helper->log('Read from CSV format'); +/** @var \PhpOffice\PhpSpreadsheet\Reader\Csv $reader */ $reader = IOFactory::createReader('Csv')->setDelimiter(',') ->setEnclosure('"') ->setSheetIndex(0); @@ -30,6 +32,7 @@ // Write CSV $filenameCSV = $helper->getFilename(__FILE__, 'csv'); +/** @var \PhpOffice\PhpSpreadsheet\Writer\Csv $writerCSV */ $writerCSV = IOFactory::createWriter($spreadsheetFromCSV, 'Csv'); $writerCSV->setExcelCompatibility(true); diff --git a/samples/Basic/26_Utf8.php b/samples/Basic/26_Utf8.php index af048246d3..52a64509b3 100644 --- a/samples/Basic/26_Utf8.php +++ b/samples/Basic/26_Utf8.php @@ -24,6 +24,7 @@ // Export to CSV (.csv) $helper->log('Write to CSV format'); +/** @var \PhpOffice\PhpSpreadsheet\Writer\Csv $writer */ $writer = IOFactory::createWriter($spreadsheet, 'Csv'); $filename = $helper->getFilename(__FILE__, 'csv'); $callStartTime = microtime(true); diff --git a/src/PhpSpreadsheet/Reader/Security/XmlScanner.php b/src/PhpSpreadsheet/Reader/Security/XmlScanner.php index c4ad035827..cc90ece91a 100644 --- a/src/PhpSpreadsheet/Reader/Security/XmlScanner.php +++ b/src/PhpSpreadsheet/Reader/Security/XmlScanner.php @@ -7,13 +7,6 @@ class XmlScanner { - /** - * Identifies whether the thread-safe libxmlDisableEntityLoader() function is available. - * - * @var bool - */ - private $libxmlDisableEntityLoader = false; - /** * String used to identify risky xml elements. * diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index 9cb287eff6..5372fef9c1 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -32,7 +32,6 @@ use PhpOffice\PhpSpreadsheet\Style\NumberFormat; use PhpOffice\PhpSpreadsheet\Style\Protection; use PhpOffice\PhpSpreadsheet\Style\Style; -use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column; use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use SimpleXMLElement; diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Styles.php b/src/PhpSpreadsheet/Reader/Xlsx/Styles.php index 3cc4054dab..c06564a3d1 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Styles.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Styles.php @@ -31,7 +31,7 @@ public function __construct(\SimpleXMLElement $styleXml) $this->styleXml = $styleXml; } - public function setStyleBaseData(Theme $theme, $styles, $cellStyles) + public function setStyleBaseData(Theme $theme = null, $styles = [], $cellStyles = []) { self::$theme = $theme; $this->styles = $styles;