From 31482fc622e53cc4e40f0235b225065adbd04d7d Mon Sep 17 00:00:00 2001 From: Chris Graham Date: Sun, 22 Mar 2015 22:58:33 +0000 Subject: [PATCH] Need to support PHP5.3 for a client unfortunately --- src/Spout/Common/Escaper/XLSX.php | 4 ++-- src/Spout/Reader/Helper/XLSX/SharedStringsHelper.php | 4 ++-- src/Spout/Reader/Helper/XLSX/WorksheetHelper.php | 2 +- src/Spout/Reader/XLSX.php | 4 ++-- src/Spout/Writer/Helper/XLSX/FileSystemHelper.php | 3 ++- src/Spout/Writer/Internal/XLSX/Workbook.php | 2 +- src/Spout/Writer/XLSX.php | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Spout/Common/Escaper/XLSX.php b/src/Spout/Common/Escaper/XLSX.php index fcb626a..8d6c255 100644 --- a/src/Spout/Common/Escaper/XLSX.php +++ b/src/Spout/Common/Escaper/XLSX.php @@ -58,8 +58,8 @@ class XLSX implements EscaperInterface */ protected function getControlCharactersEscapingMap() { - $controlCharactersEscapingMap = []; - $whitelistedControlCharacters = ["\t", "\r", "\n"]; + $controlCharactersEscapingMap = array(); + $whitelistedControlCharacters = array("\t", "\r", "\n"); // control characters values are from 0 to 1F (hex values) in the ASCII table for ($charValue = 0x0; $charValue <= 0x1F; $charValue++) { diff --git a/src/Spout/Reader/Helper/XLSX/SharedStringsHelper.php b/src/Spout/Reader/Helper/XLSX/SharedStringsHelper.php index b1a239c..04f49c9 100644 --- a/src/Spout/Reader/Helper/XLSX/SharedStringsHelper.php +++ b/src/Spout/Reader/Helper/XLSX/SharedStringsHelper.php @@ -145,9 +145,9 @@ class SharedStringsHelper */ protected function removeSuperfluousTextNodes($parentNode) { - $tagsToRemove = [ + $tagsToRemove = array( 'rPh', // Pronunciation of the text - ]; + ); foreach ($tagsToRemove as $tagToRemove) { $xpath = '//ns:' . $tagToRemove; diff --git a/src/Spout/Reader/Helper/XLSX/WorksheetHelper.php b/src/Spout/Reader/Helper/XLSX/WorksheetHelper.php index a105e01..14e3b22 100644 --- a/src/Spout/Reader/Helper/XLSX/WorksheetHelper.php +++ b/src/Spout/Reader/Helper/XLSX/WorksheetHelper.php @@ -40,7 +40,7 @@ class WorksheetHelper */ public function getWorksheets() { - $worksheets = []; + $worksheets = array(); $xmlContents = file_get_contents('zip://' . $this->filePath . '#' . self::CONTENT_TYPES_XML_FILE_PATH); diff --git a/src/Spout/Reader/XLSX.php b/src/Spout/Reader/XLSX.php index db46707..f285e89 100644 --- a/src/Spout/Reader/XLSX.php +++ b/src/Spout/Reader/XLSX.php @@ -185,7 +185,7 @@ class XLSX extends AbstractReader } $isInsideRowTag = false; - $rowData = []; + $rowData = array(); while ($this->xmlReader->read()) { if ($this->xmlReader->nodeType == \XMLReader::ELEMENT && $this->xmlReader->name === 'dimension') { @@ -230,7 +230,7 @@ class XLSX extends AbstractReader } // no data means "end of file" - return ($rowData !== []) ? $rowData : null; + return ($rowData !== array()) ? $rowData : null; } /** diff --git a/src/Spout/Writer/Helper/XLSX/FileSystemHelper.php b/src/Spout/Writer/Helper/XLSX/FileSystemHelper.php index fddbb25..d6a5692 100644 --- a/src/Spout/Writer/Helper/XLSX/FileSystemHelper.php +++ b/src/Spout/Writer/Helper/XLSX/FileSystemHelper.php @@ -179,7 +179,8 @@ EOD; */ protected function createCoreXmlFile() { - $createdDate = (new \DateTime())->format('c'); + $dt = new \DateTime(); + $createdDate = $dt->format('c'); $coreXmlFileContents = << diff --git a/src/Spout/Writer/Internal/XLSX/Workbook.php b/src/Spout/Writer/Internal/XLSX/Workbook.php index 3f8cca4..3df50b4 100644 --- a/src/Spout/Writer/Internal/XLSX/Workbook.php +++ b/src/Spout/Writer/Internal/XLSX/Workbook.php @@ -36,7 +36,7 @@ class Workbook protected $sharedStringsHelper; /** @var Worksheet[] Array containing the workbook's sheets */ - protected $worksheets = []; + protected $worksheets = array(); /** @var Worksheet The worksheet where data will be written to */ protected $currentWorksheet; diff --git a/src/Spout/Writer/XLSX.php b/src/Spout/Writer/XLSX.php index 62e98f1..b25d4a7 100644 --- a/src/Spout/Writer/XLSX.php +++ b/src/Spout/Writer/XLSX.php @@ -88,7 +88,7 @@ class XLSX extends AbstractWriter { $this->throwIfBookIsNotAvailable(); - $externalSheets = []; + $externalSheets = array(); $worksheets = $this->book->getWorksheets(); /** @var Internal\XLSX\Worksheet $worksheet */