From 440bfe637ff5e08ca8aa0b992673ca73ed6ea2cb Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Sun, 1 Oct 2017 21:50:40 +0900 Subject: [PATCH] Don't use short list syntax to keep PHP 5.6 compatibility --- .php_cs.dist | 2 +- src/PhpSpreadsheet/Calculation.php | 34 +++++++++---------- src/PhpSpreadsheet/Calculation/Functions.php | 2 +- src/PhpSpreadsheet/Calculation/LookupRef.php | 28 +++++++-------- src/PhpSpreadsheet/Calculation/MathTrig.php | 2 +- src/PhpSpreadsheet/Cell.php | 20 +++++------ .../Cell/AdvancedValueBinder.php | 4 +-- src/PhpSpreadsheet/Chart/DataSeriesValues.php | 2 +- src/PhpSpreadsheet/Chart/Renderer/JpGraph.php | 2 +- src/PhpSpreadsheet/Reader/Gnumeric.php | 4 +-- src/PhpSpreadsheet/Reader/Ods.php | 2 +- src/PhpSpreadsheet/Reader/Slk.php | 2 +- src/PhpSpreadsheet/Reader/Xls.php | 14 ++++---- src/PhpSpreadsheet/ReferenceHelper.php | 18 +++++----- src/PhpSpreadsheet/Shared/JAMA/Matrix.php | 10 +++--- src/PhpSpreadsheet/Shared/OLE.php | 10 +++--- src/PhpSpreadsheet/Shared/OLE/PPS/Root.php | 4 +-- src/PhpSpreadsheet/Shared/Xls.php | 2 +- src/PhpSpreadsheet/Style.php | 2 +- src/PhpSpreadsheet/Style/NumberFormat.php | 4 +-- src/PhpSpreadsheet/Worksheet.php | 10 +++--- src/PhpSpreadsheet/Worksheet/AutoFilter.php | 10 +++--- src/PhpSpreadsheet/Worksheet/Drawing.php | 2 +- .../Worksheet/HeaderFooterDrawing.php | 2 +- src/PhpSpreadsheet/Writer/Html.php | 6 ++-- src/PhpSpreadsheet/Writer/Xls.php | 2 +- src/PhpSpreadsheet/Writer/Xls/Escher.php | 4 +-- src/PhpSpreadsheet/Writer/Xls/Parser.php | 32 ++++++++--------- src/PhpSpreadsheet/Writer/Xls/Worksheet.php | 22 ++++++------ src/PhpSpreadsheet/Writer/Xlsx/Comments.php | 2 +- src/PhpSpreadsheet/Writer/Xlsx/Workbook.php | 2 +- src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php | 4 +-- tests/PhpSpreadsheetTests/Custom/Complex.php | 4 +-- 33 files changed, 135 insertions(+), 135 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index 6c6d0e3f..9467d869 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -47,7 +47,7 @@ return PhpCsFixer\Config::create() 'is_null' => ['use_yoda_style' => false], 'linebreak_after_opening_tag' => true, 'line_ending' => true, - 'list_syntax' => ['syntax' => 'short'], + 'list_syntax' => ['syntax' => 'long'], // Stay compatiblew with PHP 5.6 'lowercase_cast' => true, 'lowercase_constants' => true, 'lowercase_keywords' => true, diff --git a/src/PhpSpreadsheet/Calculation.php b/src/PhpSpreadsheet/Calculation.php index f8239371..f41c1489 100644 --- a/src/PhpSpreadsheet/Calculation.php +++ b/src/PhpSpreadsheet/Calculation.php @@ -2217,7 +2217,7 @@ class Calculation // Identify our locale and language $language = $locale = strtolower($locale); if (strpos($locale, '_') !== false) { - [$language] = explode('_', $locale); + list($language) = explode('_', $locale); } if (count(self::$validLocaleLanguages) == 1) { @@ -2243,9 +2243,9 @@ class Calculation // Retrieve the list of locale or language specific function names $localeFunctions = file($functionNamesFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($localeFunctions as $localeFunction) { - [$localeFunction] = explode('##', $localeFunction); // Strip out comments + list($localeFunction) = explode('##', $localeFunction); // Strip out comments if (strpos($localeFunction, '=') !== false) { - [$fName, $lfName] = explode('=', $localeFunction); + list($fName, $lfName) = explode('=', $localeFunction); $fName = trim($fName); $lfName = trim($lfName); if ((isset(self::$phpSpreadsheetFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) { @@ -2268,9 +2268,9 @@ class Calculation if (file_exists($configFile)) { $localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($localeSettings as $localeSetting) { - [$localeSetting] = explode('##', $localeSetting); // Strip out comments + list($localeSetting) = explode('##', $localeSetting); // Strip out comments if (strpos($localeSetting, '=') !== false) { - [$settingName, $settingValue] = explode('=', $localeSetting); + list($settingName, $settingValue) = explode('=', $localeSetting); $settingName = strtoupper(trim($settingName)); switch ($settingName) { case 'ARGUMENTSEPARATOR': @@ -2766,17 +2766,17 @@ class Calculation // Examine each of the two operands, and turn them into an array if they aren't one already // Note that this function should only be called if one or both of the operand is already an array if (!is_array($operand1)) { - [$matrixRows, $matrixColumns] = self::getMatrixDimensions($operand2); + list($matrixRows, $matrixColumns) = self::getMatrixDimensions($operand2); $operand1 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand1)); $resize = 0; } elseif (!is_array($operand2)) { - [$matrixRows, $matrixColumns] = self::getMatrixDimensions($operand1); + list($matrixRows, $matrixColumns) = self::getMatrixDimensions($operand1); $operand2 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand2)); $resize = 0; } - [$matrix1Rows, $matrix1Columns] = self::getMatrixDimensions($operand1); - [$matrix2Rows, $matrix2Columns] = self::getMatrixDimensions($operand2); + list($matrix1Rows, $matrix1Columns) = self::getMatrixDimensions($operand1); + list($matrix2Rows, $matrix2Columns) = self::getMatrixDimensions($operand2); if (($matrix1Rows == $matrix2Columns) && ($matrix2Rows == $matrix1Columns)) { $resize = 1; } @@ -3286,14 +3286,14 @@ class Calculation $startRowColRef = $output[count($output) - 1]['value']; $rangeWS1 = ''; if (strpos('!', $startRowColRef) !== false) { - [$rangeWS1, $startRowColRef] = explode('!', $startRowColRef); + list($rangeWS1, $startRowColRef) = explode('!', $startRowColRef); } if ($rangeWS1 != '') { $rangeWS1 .= '!'; } $rangeWS2 = $rangeWS1; if (strpos('!', $val) !== false) { - [$rangeWS2, $val] = explode('!', $val); + list($rangeWS2, $val) = explode('!', $val); } if ($rangeWS2 != '') { $rangeWS2 .= '!'; @@ -3471,12 +3471,12 @@ class Calculation case ':': // Range $sheet1 = $sheet2 = ''; if (strpos($operand1Data['reference'], '!') !== false) { - [$sheet1, $operand1Data['reference']] = explode('!', $operand1Data['reference']); + list($sheet1, $operand1Data['reference']) = explode('!', $operand1Data['reference']); } else { $sheet1 = ($pCellParent !== null) ? $pCellWorksheet->getTitle() : ''; } if (strpos($operand2Data['reference'], '!') !== false) { - [$sheet2, $operand2Data['reference']] = explode('!', $operand2Data['reference']); + list($sheet2, $operand2Data['reference']) = explode('!', $operand2Data['reference']); } else { $sheet2 = $sheet1; } @@ -4108,7 +4108,7 @@ class Calculation if ($pSheet !== null) { $pSheetName = $pSheet->getTitle(); if (strpos($pRange, '!') !== false) { - [$pSheetName, $pRange] = Worksheet::extractSheetTitle($pRange, true); + list($pSheetName, $pRange) = Worksheet::extractSheetTitle($pRange, true); $pSheet = $this->spreadsheet->getSheetByName($pSheetName); } @@ -4159,7 +4159,7 @@ class Calculation if ($pSheet !== null) { $pSheetName = $pSheet->getTitle(); if (strpos($pRange, '!') !== false) { - [$pSheetName, $pRange] = Worksheet::extractSheetTitle($pRange, true); + list($pSheetName, $pRange) = Worksheet::extractSheetTitle($pRange, true); $pSheet = $this->spreadsheet->getSheetByName($pSheetName); } @@ -4183,7 +4183,7 @@ class Calculation $aReferences = Cell::extractAllCellReferencesInRange($pRange); if (!isset($aReferences[1])) { // Single cell (or single column or row) in range - [$currentCol, $currentRow] = Cell::coordinateFromString($aReferences[0]); + list($currentCol, $currentRow) = Cell::coordinateFromString($aReferences[0]); if ($pSheet->cellExists($aReferences[0])) { $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog); } else { @@ -4193,7 +4193,7 @@ class Calculation // Extract cell data for all cells in the range foreach ($aReferences as $reference) { // Extract range - [$currentCol, $currentRow] = Cell::coordinateFromString($reference); + list($currentCol, $currentRow) = Cell::coordinateFromString($reference); if ($pSheet->cellExists($reference)) { $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog); } else { diff --git a/src/PhpSpreadsheet/Calculation/Functions.php b/src/PhpSpreadsheet/Calculation/Functions.php index f2539dfa..ba5db696 100644 --- a/src/PhpSpreadsheet/Calculation/Functions.php +++ b/src/PhpSpreadsheet/Calculation/Functions.php @@ -278,7 +278,7 @@ class Functions return '=' . $condition; } preg_match('/([<>=]+)(.*)/', $condition, $matches); - [, $operator, $operand] = $matches; + list(, $operator, $operand) = $matches; if (!is_numeric($operand)) { $operand = str_replace('"', '""', $operand); diff --git a/src/PhpSpreadsheet/Calculation/LookupRef.php b/src/PhpSpreadsheet/Calculation/LookupRef.php index a167b8c8..a6013e6f 100644 --- a/src/PhpSpreadsheet/Calculation/LookupRef.php +++ b/src/PhpSpreadsheet/Calculation/LookupRef.php @@ -103,10 +103,10 @@ class LookupRef } } else { if (strpos($cellAddress, '!') !== false) { - [$sheet, $cellAddress] = explode('!', $cellAddress); + list($sheet, $cellAddress) = explode('!', $cellAddress); } if (strpos($cellAddress, ':') !== false) { - [$startAddress, $endAddress] = explode(':', $cellAddress); + list($startAddress, $endAddress) = explode(':', $cellAddress); $startAddress = preg_replace('/[^a-z]/i', '', $startAddress); $endAddress = preg_replace('/[^a-z]/i', '', $endAddress); $returnValue = []; @@ -145,7 +145,7 @@ class LookupRef reset($cellAddress); $isMatrix = (is_numeric(key($cellAddress))); - [$columns, $rows] = Calculation::_getMatrixDimensions($cellAddress); + list($columns, $rows) = Calculation::_getMatrixDimensions($cellAddress); if ($isMatrix) { return $rows; @@ -184,10 +184,10 @@ class LookupRef } } else { if (strpos($cellAddress, '!') !== false) { - [$sheet, $cellAddress] = explode('!', $cellAddress); + list($sheet, $cellAddress) = explode('!', $cellAddress); } if (strpos($cellAddress, ':') !== false) { - [$startAddress, $endAddress] = explode(':', $cellAddress); + list($startAddress, $endAddress) = explode(':', $cellAddress); $startAddress = preg_replace('/[^0-9]/', '', $startAddress); $endAddress = preg_replace('/[^0-9]/', '', $endAddress); $returnValue = []; @@ -197,7 +197,7 @@ class LookupRef return $returnValue; } - [$cellAddress] = explode(':', $cellAddress); + list($cellAddress) = explode(':', $cellAddress); return (int) preg_replace('/[^0-9]/', '', $cellAddress); } @@ -226,7 +226,7 @@ class LookupRef reset($cellAddress); $isMatrix = (is_numeric(key($cellAddress))); - [$columns, $rows] = Calculation::_getMatrixDimensions($cellAddress); + list($columns, $rows) = Calculation::_getMatrixDimensions($cellAddress); if ($isMatrix) { return $columns; @@ -296,7 +296,7 @@ class LookupRef $cellAddress1 = $cellAddress; $cellAddress2 = null; if (strpos($cellAddress, ':') !== false) { - [$cellAddress1, $cellAddress2] = explode(':', $cellAddress); + list($cellAddress1, $cellAddress2) = explode(':', $cellAddress); } if ((!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress1, $matches)) || @@ -306,7 +306,7 @@ class LookupRef } if (strpos($cellAddress, '!') !== false) { - [$sheetName, $cellAddress] = explode('!', $cellAddress); + list($sheetName, $cellAddress) = explode('!', $cellAddress); $sheetName = trim($sheetName, "'"); $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName); } else { @@ -317,7 +317,7 @@ class LookupRef } if (strpos($cellAddress, '!') !== false) { - [$sheetName, $cellAddress] = explode('!', $cellAddress); + list($sheetName, $cellAddress) = explode('!', $cellAddress); $sheetName = trim($sheetName, "'"); $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName); } else { @@ -375,16 +375,16 @@ class LookupRef $sheetName = null; if (strpos($cellAddress, '!')) { - [$sheetName, $cellAddress] = explode('!', $cellAddress); + list($sheetName, $cellAddress) = explode('!', $cellAddress); $sheetName = trim($sheetName, "'"); } if (strpos($cellAddress, ':')) { - [$startCell, $endCell] = explode(':', $cellAddress); + list($startCell, $endCell) = explode(':', $cellAddress); } else { $startCell = $endCell = $cellAddress; } - [$startCellColumn, $startCellRow] = Cell::coordinateFromString($startCell); - [$endCellColumn, $endCellRow] = Cell::coordinateFromString($endCell); + list($startCellColumn, $startCellRow) = Cell::coordinateFromString($startCell); + list($endCellColumn, $endCellRow) = Cell::coordinateFromString($endCell); $startCellRow += $rows; $startCellColumn = Cell::columnIndexFromString($startCellColumn) - 1; diff --git a/src/PhpSpreadsheet/Calculation/MathTrig.php b/src/PhpSpreadsheet/Calculation/MathTrig.php index 63351930..14d7a8e4 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -1110,7 +1110,7 @@ class MathTrig return array_filter( $args, function ($index) use ($cellReference) { - [, $row, $column] = explode('.', $index); + list(, $row, $column) = explode('.', $index); return $cellReference->getWorksheet()->getRowDimension($row)->getVisible() && $cellReference->getWorksheet()->getColumnDimension($column)->getVisible(); diff --git a/src/PhpSpreadsheet/Cell.php b/src/PhpSpreadsheet/Cell.php index c6fd30ff..f709310c 100644 --- a/src/PhpSpreadsheet/Cell.php +++ b/src/PhpSpreadsheet/Cell.php @@ -500,7 +500,7 @@ class Cell { if ($mergeRange = $this->getMergeRange()) { $mergeRange = self::splitRange($mergeRange); - [$startCell] = $mergeRange[0]; + list($startCell) = $mergeRange[0]; if ($this->getCoordinate() === $startCell) { return true; } @@ -558,7 +558,7 @@ class Cell */ public function isInRange($pRange) { - [$rangeStart, $rangeEnd] = self::rangeBoundaries($pRange); + list($rangeStart, $rangeEnd) = self::rangeBoundaries($pRange); // Translate properties $myColumn = self::columnIndexFromString($this->getColumn()); @@ -608,7 +608,7 @@ class Cell $worksheet = ''; $cellAddress = explode('!', $pCoordinateString); if (count($cellAddress) > 1) { - [$worksheet, $pCoordinateString] = $cellAddress; + list($worksheet, $pCoordinateString) = $cellAddress; } if ($worksheet > '') { $worksheet .= '!'; @@ -643,14 +643,14 @@ class Cell $worksheet = ''; $cellAddress = explode('!', $pCoordinateString); if (count($cellAddress) > 1) { - [$worksheet, $pCoordinateString] = $cellAddress; + list($worksheet, $pCoordinateString) = $cellAddress; } if ($worksheet > '') { $worksheet .= '!'; } // Create absolute coordinate - [$column, $row] = self::coordinateFromString($pCoordinateString); + list($column, $row) = self::coordinateFromString($pCoordinateString); $column = ltrim($column, '$'); $row = ltrim($row, '$'); @@ -734,7 +734,7 @@ class Cell if (strpos($pRange, ':') === false) { $rangeA = $rangeB = $pRange; } else { - [$rangeA, $rangeB] = explode(':', $pRange); + list($rangeA, $rangeB) = explode(':', $pRange); } // Calculate range outer borders @@ -758,7 +758,7 @@ class Cell public static function rangeDimension($pRange) { // Calculate range outer borders - [$rangeStart, $rangeEnd] = self::rangeBoundaries($pRange); + list($rangeStart, $rangeEnd) = self::rangeBoundaries($pRange); return [($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1)]; } @@ -785,7 +785,7 @@ class Cell if (strpos($pRange, ':') === false) { $rangeA = $rangeB = $pRange; } else { - [$rangeA, $rangeB] = explode(':', $pRange); + list($rangeA, $rangeB) = explode(':', $pRange); } return [self::coordinateFromString($rangeA), self::coordinateFromString($rangeB)]; @@ -897,7 +897,7 @@ class Cell } // Range... - [$rangeStart, $rangeEnd] = $range; + list($rangeStart, $rangeEnd) = $range; sscanf($rangeStart, '%[A-Z]%d', $startCol, $startRow); sscanf($rangeEnd, '%[A-Z]%d', $endCol, $endRow); ++$endCol; @@ -952,7 +952,7 @@ class Cell $hashedValues = []; foreach ($pCoordCollection as $coord => $value) { - [$column, $row] = self::coordinateFromString($coord); + list($column, $row) = self::coordinateFromString($coord); $row = (int) (ltrim($row, '$')); $hashCode = $column . '-' . (is_object($value) ? $value->getHashCode() : $value); diff --git a/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php b/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php index 87cc9266..3a40bf90 100644 --- a/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php +++ b/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php @@ -117,7 +117,7 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder // Check for time without seconds e.g. '9:45', '09:45' if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) { // Convert value to number - [$h, $m] = explode(':', $value); + list($h, $m) = explode(':', $value); $days = $h / 24 + $m / 1440; $cell->setValueExplicit($days, DataType::TYPE_NUMERIC); // Set style @@ -130,7 +130,7 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder // Check for time with seconds '9:45:59', '09:45:59' if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) { // Convert value to number - [$h, $m, $s] = explode(':', $value); + list($h, $m, $s) = explode(':', $value); $days = $h / 24 + $m / 1440 + $s / 86400; // Convert value to number $cell->setValueExplicit($days, DataType::TYPE_NUMERIC); diff --git a/src/PhpSpreadsheet/Chart/DataSeriesValues.php b/src/PhpSpreadsheet/Chart/DataSeriesValues.php index ac179762..12c5acb6 100644 --- a/src/PhpSpreadsheet/Chart/DataSeriesValues.php +++ b/src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -324,7 +324,7 @@ class DataSeriesValues } else { $cellRange = explode('!', $this->dataSource); if (count($cellRange) > 1) { - [, $cellRange] = $cellRange; + list(, $cellRange) = $cellRange; } $dimensions = Cell::rangeDimension(str_replace('$', '', $cellRange)); diff --git a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php index 8b999e64..9834f608 100644 --- a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php +++ b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php @@ -405,7 +405,7 @@ class JpGraph $seriesPlot->link->SetColor(self::$colourSet[self::$plotColour]); } elseif ($scatterStyle == 'smoothMarker') { $spline = new Spline($dataValuesY, $dataValuesX); - [$splineDataY, $splineDataX] = $spline->Get(count($dataValuesX) * self::$width / 20); + list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$width / 20); $lplot = new LinePlot($splineDataX, $splineDataY); $lplot->SetColor(self::$colourSet[self::$plotColour]); diff --git a/src/PhpSpreadsheet/Reader/Gnumeric.php b/src/PhpSpreadsheet/Reader/Gnumeric.php index 17547d29..c766f400 100644 --- a/src/PhpSpreadsheet/Reader/Gnumeric.php +++ b/src/PhpSpreadsheet/Reader/Gnumeric.php @@ -276,7 +276,7 @@ class Gnumeric extends BaseReader implements IReader break; case 'user-defined': - [, $attrName] = explode(':', $attributes['name']); + list(, $attrName) = explode(':', $attributes['name']); switch ($attrName) { case 'publisher': $docProps->setCompany(trim($propertyValue)); @@ -888,7 +888,7 @@ class Gnumeric extends BaseReader implements IReader private static function parseGnumericColour($gnmColour) { - [$gnmR, $gnmG, $gnmB] = explode(':', $gnmColour); + list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour); $gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2); $gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2); $gnmB = substr(str_pad($gnmB, 4, '0', STR_PAD_RIGHT), 0, 2); diff --git a/src/PhpSpreadsheet/Reader/Ods.php b/src/PhpSpreadsheet/Reader/Ods.php index 3994606d..39bba5f0 100644 --- a/src/PhpSpreadsheet/Reader/Ods.php +++ b/src/PhpSpreadsheet/Reader/Ods.php @@ -591,7 +591,7 @@ class Ods extends BaseReader implements IReader $dateObj = new DateTime($value, $GMT); $dateObj->setTimeZone($timezoneObj); - [$year, $month, $day, $hour, $minute, $second] = explode( + list($year, $month, $day, $hour, $minute, $second) = explode( ' ', $dateObj->format('Y m d H i s') ); diff --git a/src/PhpSpreadsheet/Reader/Slk.php b/src/PhpSpreadsheet/Reader/Slk.php index ec73496a..aa94d739 100644 --- a/src/PhpSpreadsheet/Reader/Slk.php +++ b/src/PhpSpreadsheet/Reader/Slk.php @@ -385,7 +385,7 @@ class Slk extends BaseReader implements IReader break; case 'W': - [$startCol, $endCol, $columnWidth] = explode(' ', substr($rowDatum, 1)); + list($startCol, $endCol, $columnWidth) = explode(' ', substr($rowDatum, 1)); break; case 'S': diff --git a/src/PhpSpreadsheet/Reader/Xls.php b/src/PhpSpreadsheet/Reader/Xls.php index 4b345a9b..624ed1e4 100644 --- a/src/PhpSpreadsheet/Reader/Xls.php +++ b/src/PhpSpreadsheet/Reader/Xls.php @@ -1085,8 +1085,8 @@ class Xls extends BaseReader implements IReader } // calculate the width and height of the shape - [$startColumn, $startRow] = Cell::coordinateFromString($spContainer->getStartCoordinates()); - [$endColumn, $endRow] = Cell::coordinateFromString($spContainer->getEndCoordinates()); + list($startColumn, $startRow) = Cell::coordinateFromString($spContainer->getStartCoordinates()); + list($endColumn, $endRow) = Cell::coordinateFromString($spContainer->getEndCoordinates()); $startOffsetX = $spContainer->getStartOffsetX(); $startOffsetY = $spContainer->getStartOffsetY(); @@ -1171,7 +1171,7 @@ class Xls extends BaseReader implements IReader // treat SHAREDFMLA records if ($this->version == self::XLS_BIFF8) { foreach ($this->sharedFormulaParts as $cell => $baseCell) { - [$column, $row] = Cell::coordinateFromString($cell); + list($column, $row) = Cell::coordinateFromString($cell); if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($column, $row, $this->phpSheet->getTitle())) { $formula = $this->getFormulaFromStructure($this->sharedFormulas[$baseCell], $cell); $this->phpSheet->getCell($cell)->setValueExplicit('=' . $formula, Cell\DataType::TYPE_FORMULA); @@ -1247,8 +1247,8 @@ class Xls extends BaseReader implements IReader $coordinateStrings = explode(':', $extractedRange); if (count($coordinateStrings) == 2) { - [$firstColumn, $firstRow] = Cell::coordinateFromString($coordinateStrings[0]); - [$lastColumn, $lastRow] = Cell::coordinateFromString($coordinateStrings[1]); + list($firstColumn, $firstRow) = Cell::coordinateFromString($coordinateStrings[0]); + list($lastColumn, $lastRow) = Cell::coordinateFromString($coordinateStrings[1]); if ($firstColumn == 'A' and $lastColumn == 'IV') { // then we have repeating rows @@ -7201,7 +7201,7 @@ class Xls extends BaseReader implements IReader */ private function readBIFF8CellAddressB($cellAddressStructure, $baseCell = 'A1') { - [$baseCol, $baseRow] = Cell::coordinateFromString($baseCell); + list($baseCol, $baseRow) = Cell::coordinateFromString($baseCell); $baseCol = Cell::columnIndexFromString($baseCol) - 1; // offset: 0; size: 2; index to row (0... 65535) (or offset (-32768... 32767)) @@ -7384,7 +7384,7 @@ class Xls extends BaseReader implements IReader */ private function readBIFF8CellRangeAddressB($subData, $baseCell = 'A1') { - [$baseCol, $baseRow] = Cell::coordinateFromString($baseCell); + list($baseCol, $baseRow) = Cell::coordinateFromString($baseCell); $baseCol = Cell::columnIndexFromString($baseCol) - 1; // TODO: if cell range is just a single cell, should this funciton diff --git a/src/PhpSpreadsheet/ReferenceHelper.php b/src/PhpSpreadsheet/ReferenceHelper.php index 9a7b6785..9e6e7b2b 100644 --- a/src/PhpSpreadsheet/ReferenceHelper.php +++ b/src/PhpSpreadsheet/ReferenceHelper.php @@ -122,7 +122,7 @@ class ReferenceHelper */ private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols) { - [$cellColumn, $cellRow] = Cell::coordinateFromString($cellAddress); + list($cellColumn, $cellRow) = Cell::coordinateFromString($cellAddress); $cellColumnIndex = Cell::columnIndexFromString($cellColumn); // Is cell within the range of rows/columns if we're deleting if ($pNumRows < 0 && @@ -309,7 +309,7 @@ class ReferenceHelper if (!empty($aColumnDimensions)) { foreach ($aColumnDimensions as $objColumnDimension) { $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows); - [$newReference] = Cell::coordinateFromString($newReference); + list($newReference) = Cell::coordinateFromString($newReference); if ($objColumnDimension->getColumnIndex() != $newReference) { $objColumnDimension->setColumnIndex($newReference); } @@ -334,7 +334,7 @@ class ReferenceHelper if (!empty($aRowDimensions)) { foreach ($aRowDimensions as $objRowDimension) { $newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows); - [, $newReference] = Cell::coordinateFromString($newReference); + list(, $newReference) = Cell::coordinateFromString($newReference); if ($objRowDimension->getRowIndex() != $newReference) { $objRowDimension->setRowIndex($newReference); } @@ -370,7 +370,7 @@ class ReferenceHelper // Get coordinate of $pBefore $beforeColumn = 'A'; $beforeRow = 1; - [$beforeColumn, $beforeRow] = Cell::coordinateFromString($pBefore); + list($beforeColumn, $beforeRow) = Cell::coordinateFromString($pBefore); $beforeColumnIndex = Cell::columnIndexFromString($beforeColumn); // Clear cells if we are removing columns or rows @@ -529,7 +529,7 @@ class ReferenceHelper if (count($autoFilterColumns) > 0) { sscanf($pBefore, '%[A-Z]%d', $column, $row); $columnIndex = Cell::columnIndexFromString($column); - [$rangeStart, $rangeEnd] = Cell::rangeBoundaries($autoFilterRange); + list($rangeStart, $rangeEnd) = Cell::rangeBoundaries($autoFilterRange); if ($columnIndex <= $rangeEnd[0]) { if ($pNumCols < 0) { // If we're actually deleting any columns that fall within the autofilter range, @@ -696,7 +696,7 @@ class ReferenceHelper if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { $toString = ($match[2] > '') ? $match[2] . '!' : ''; $toString .= $modified3 . ':' . $modified4; - [$column, $row] = Cell::coordinateFromString($match[3]); + list($column, $row) = Cell::coordinateFromString($match[3]); // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more $column = Cell::columnIndexFromString(trim($column, '$')) + 100000; $row = trim($row, '$') + 10000000; @@ -722,7 +722,7 @@ class ReferenceHelper if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { $toString = ($match[2] > '') ? $match[2] . '!' : ''; $toString .= $modified3; - [$column, $row] = Cell::coordinateFromString($match[3]); + list($column, $row) = Cell::coordinateFromString($match[3]); // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more $column = Cell::columnIndexFromString(trim($column, '$')) + 100000; $row = trim($row, '$') + 10000000; @@ -866,10 +866,10 @@ class ReferenceHelper { if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) { // Get coordinate of $pBefore - [$beforeColumn, $beforeRow] = Cell::coordinateFromString($pBefore); + list($beforeColumn, $beforeRow) = Cell::coordinateFromString($pBefore); // Get coordinate of $pCellReference - [$newColumn, $newRow] = Cell::coordinateFromString($pCellReference); + list($newColumn, $newRow) = Cell::coordinateFromString($pCellReference); // Verify which parts should be updated $updateColumn = (($newColumn[0] != '$') && ($beforeColumn[0] != '$') && (Cell::columnIndexFromString($newColumn) >= Cell::columnIndexFromString($beforeColumn))); diff --git a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php index 2d1d3fdb..956d2dbc 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php +++ b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php @@ -171,7 +171,7 @@ class Matrix switch ($match) { //A($i0...; $j0...) case 'integer,integer': - [$i0, $j0] = $args; + list($i0, $j0) = $args; if ($i0 >= 0) { $m = $this->m - $i0; } else { @@ -193,7 +193,7 @@ class Matrix break; //A($i0...$iF; $j0...$jF) case 'integer,integer,integer,integer': - [$i0, $iF, $j0, $jF] = $args; + list($i0, $iF, $j0, $jF) = $args; if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { @@ -215,7 +215,7 @@ class Matrix break; //$R = array of row indices; $C = array of column indices case 'array,array': - [$RL, $CL] = $args; + list($RL, $CL) = $args; if (count($RL) > 0) { $m = count($RL); } else { @@ -237,7 +237,7 @@ class Matrix break; //A($i0...$iF); $CL = array of column indices case 'integer,integer,array': - [$i0, $iF, $CL] = $args; + list($i0, $iF, $CL) = $args; if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { @@ -259,7 +259,7 @@ class Matrix break; //$RL = array of row indices case 'array,integer,integer': - [$RL, $j0, $jF] = $args; + list($RL, $j0, $jF) = $args; if (count($RL) > 0) { $m = count($RL); } else { diff --git a/src/PhpSpreadsheet/Shared/OLE.php b/src/PhpSpreadsheet/Shared/OLE.php index 686fff83..bcec3df7 100644 --- a/src/PhpSpreadsheet/Shared/OLE.php +++ b/src/PhpSpreadsheet/Shared/OLE.php @@ -245,7 +245,7 @@ class OLE */ private static function _readInt1($fh) { - [, $tmp] = unpack('c', fread($fh, 1)); + list(, $tmp) = unpack('c', fread($fh, 1)); return $tmp; } @@ -259,7 +259,7 @@ class OLE */ private static function _readInt2($fh) { - [, $tmp] = unpack('v', fread($fh, 2)); + list(, $tmp) = unpack('v', fread($fh, 2)); return $tmp; } @@ -273,7 +273,7 @@ class OLE */ private static function _readInt4($fh) { - [, $tmp] = unpack('V', fread($fh, 4)); + list(, $tmp) = unpack('V', fread($fh, 4)); return $tmp; } @@ -546,8 +546,8 @@ class OLE // factor used for separating numbers into 4 bytes parts $factor = pow(2, 32); - [, $high_part] = unpack('V', substr($string, 4, 4)); - [, $low_part] = unpack('V', substr($string, 0, 4)); + list(, $high_part) = unpack('V', substr($string, 4, 4)); + list(, $low_part) = unpack('V', substr($string, 0, 4)); $big_date = ($high_part * $factor) + $low_part; // translate to seconds diff --git a/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php b/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php index 1e1487b9..844a1dbb 100644 --- a/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php +++ b/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php @@ -98,7 +98,7 @@ class Root extends PPS $aList = []; PPS::_savePpsSetPnt($aList, [$this]); // calculate values for header - [$iSBDcnt, $iBBcnt, $iPPScnt] = $this->_calcSize($aList); //, $rhInfo); + list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo); // Save Header $this->_saveHeader($iSBDcnt, $iBBcnt, $iPPScnt); @@ -129,7 +129,7 @@ class Root extends PPS public function _calcSize(&$raList) { // Calculate Basic Setting - [$iSBDcnt, $iBBcnt, $iPPScnt] = [0, 0, 0]; + list($iSBDcnt, $iBBcnt, $iPPScnt) = [0, 0, 0]; $iSmallLen = 0; $iSBcnt = 0; $iCount = count($raList); diff --git a/src/PhpSpreadsheet/Shared/Xls.php b/src/PhpSpreadsheet/Shared/Xls.php index f20e9310..6b3740c7 100644 --- a/src/PhpSpreadsheet/Shared/Xls.php +++ b/src/PhpSpreadsheet/Shared/Xls.php @@ -211,7 +211,7 @@ class Xls */ public static function oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height) { - [$column, $row] = Cell::coordinateFromString($coordinates); + list($column, $row) = Cell::coordinateFromString($coordinates); $col_start = Cell::columnIndexFromString($column) - 1; $row_start = $row - 1; diff --git a/src/PhpSpreadsheet/Style.php b/src/PhpSpreadsheet/Style.php index 2fed829b..40bf40d6 100644 --- a/src/PhpSpreadsheet/Style.php +++ b/src/PhpSpreadsheet/Style.php @@ -199,7 +199,7 @@ class Style extends Style\Supervisor implements IComparable $rangeA = $pRange; $rangeB = $pRange; } else { - [$rangeA, $rangeB] = explode(':', $pRange); + list($rangeA, $rangeB) = explode(':', $pRange); } // Calculate range outer borders diff --git a/src/PhpSpreadsheet/Style/NumberFormat.php b/src/PhpSpreadsheet/Style/NumberFormat.php index d4f196cb..119e15bf 100644 --- a/src/PhpSpreadsheet/Style/NumberFormat.php +++ b/src/PhpSpreadsheet/Style/NumberFormat.php @@ -724,7 +724,7 @@ class NumberFormat extends Supervisor implements IComparable // Currency or Accounting $currencyFormat = $m[0]; $currencyCode = $m[1]; - [$currencyCode] = explode('-', $currencyCode); + list($currencyCode) = explode('-', $currencyCode); if ($currencyCode == '') { $currencyCode = StringHelper::getCurrencyCode(); } @@ -738,7 +738,7 @@ class NumberFormat extends Supervisor implements IComparable // Additional formatting provided by callback function if ($callBack !== null) { - [$writerInstance, $function] = $callBack; + list($writerInstance, $function) = $callBack; $value = $writerInstance->$function($value, $formatColor); } diff --git a/src/PhpSpreadsheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet.php index acda2fc9..1fdaeb80 100644 --- a/src/PhpSpreadsheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet.php @@ -1543,7 +1543,7 @@ class Worksheet implements IComparable } // Calculate range outer borders - [$rangeStart, $rangeEnd] = Cell::rangeBoundaries($pRange . ':' . $pRange); + list($rangeStart, $rangeEnd) = Cell::rangeBoundaries($pRange . ':' . $pRange); // Make sure we can loop upwards on rows and columns if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { @@ -1583,7 +1583,7 @@ class Worksheet implements IComparable } // Calculate range outer borders - [$rangeStart, $rangeEnd] = Cell::rangeBoundaries($pRange . ':' . $pRange); + list($rangeStart, $rangeEnd) = Cell::rangeBoundaries($pRange . ':' . $pRange); // Make sure we can loop upwards on rows and columns if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { @@ -2401,7 +2401,7 @@ class Worksheet implements IComparable $pCoordinate = preg_replace('/^([0-9]+):([0-9]+)$/', 'A${1}:XFD${2}', $pCoordinate); if (strpos($pCoordinate, ':') !== false || strpos($pCoordinate, ',') !== false) { - [$first] = Cell::splitRange($pCoordinate); + list($first) = Cell::splitRange($pCoordinate); $this->activeCell = $first[0]; } else { $this->activeCell = $pCoordinate; @@ -2470,7 +2470,7 @@ class Worksheet implements IComparable } // start coordinate - [$startColumn, $startRow] = Cell::coordinateFromString($startCell); + list($startColumn, $startRow) = Cell::coordinateFromString($startCell); // Loop through $source foreach ($source as $rowData) { @@ -2512,7 +2512,7 @@ class Worksheet implements IComparable // Returnvalue $returnValue = []; // Identify the range that we need to extract from the worksheet - [$rangeStart, $rangeEnd] = Cell::rangeBoundaries($pRange); + list($rangeStart, $rangeEnd) = Cell::rangeBoundaries($pRange); $minCol = Cell::stringFromColumnIndex($rangeStart[0] - 1); $minRow = $rangeStart[1]; $maxCol = Cell::stringFromColumnIndex($rangeEnd[0] - 1); diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter.php b/src/PhpSpreadsheet/Worksheet/AutoFilter.php index 303f1b85..ac04c715 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter.php @@ -93,7 +93,7 @@ class AutoFilter // Uppercase coordinate $cellAddress = explode('!', strtoupper($pRange)); if (count($cellAddress) > 1) { - [$worksheet, $pRange] = $cellAddress; + list($worksheet, $pRange) = $cellAddress; } if (strpos($pRange, ':') !== false) { @@ -109,7 +109,7 @@ class AutoFilter $this->columns = []; } else { // Discard any column rules that are no longer valid within this range - [$rangeStart, $rangeEnd] = Cell::rangeBoundaries($this->range); + list($rangeStart, $rangeEnd) = Cell::rangeBoundaries($this->range); foreach ($this->columns as $key => $value) { $colIndex = Cell::columnIndexFromString($key); if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) { @@ -149,7 +149,7 @@ class AutoFilter } $columnIndex = Cell::columnIndexFromString($column); - [$rangeStart, $rangeEnd] = Cell::rangeBoundaries($this->range); + list($rangeStart, $rangeEnd) = Cell::rangeBoundaries($this->range); if (($rangeStart[0] > $columnIndex) || ($rangeEnd[0] < $columnIndex)) { throw new PhpSpreadsheetException('Column is outside of current autofilter range.'); } @@ -202,7 +202,7 @@ class AutoFilter */ public function getColumnByOffset($pColumnOffset) { - [$rangeStart, $rangeEnd] = Cell::rangeBoundaries($this->range); + list($rangeStart, $rangeEnd) = Cell::rangeBoundaries($this->range); $pColumn = Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1); return $this->getColumn($pColumn); @@ -624,7 +624,7 @@ class AutoFilter */ public function showHideRows() { - [$rangeStart, $rangeEnd] = Cell::rangeBoundaries($this->range); + list($rangeStart, $rangeEnd) = Cell::rangeBoundaries($this->range); // The heading row should always be visible $this->workSheet->getRowDimension($rangeStart[1])->setVisible(true); diff --git a/src/PhpSpreadsheet/Worksheet/Drawing.php b/src/PhpSpreadsheet/Worksheet/Drawing.php index 5f671fa0..12c81041 100644 --- a/src/PhpSpreadsheet/Worksheet/Drawing.php +++ b/src/PhpSpreadsheet/Worksheet/Drawing.php @@ -89,7 +89,7 @@ class Drawing extends BaseDrawing implements IComparable if ($this->width == 0 && $this->height == 0) { // Get width/height - [$this->width, $this->height] = getimagesize($pValue); + list($this->width, $this->height) = getimagesize($pValue); } } else { throw new PhpSpreadsheetException("File $pValue not found!"); diff --git a/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php b/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php index 4e7b70ce..18a152e6 100644 --- a/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php @@ -311,7 +311,7 @@ class HeaderFooterDrawing extends Drawing implements IComparable if ($this->width == 0 && $this->height == 0) { // Get width/height - [$this->width, $this->height] = getimagesize($pValue); + list($this->width, $this->height) = getimagesize($pValue); } } else { throw new PhpSpreadsheetException("File $pValue not found!"); diff --git a/src/PhpSpreadsheet/Writer/Html.php b/src/PhpSpreadsheet/Writer/Html.php index 20fb9f35..ca92abad 100644 --- a/src/PhpSpreadsheet/Writer/Html.php +++ b/src/PhpSpreadsheet/Writer/Html.php @@ -1548,14 +1548,14 @@ class Html extends BaseWriter implements IWriter // loop through all Excel merged cells foreach ($sheet->getMergeCells() as $cells) { - [$cells] = Cell::splitRange($cells); + list($cells) = Cell::splitRange($cells); $first = $cells[0]; $last = $cells[1]; - [$fc, $fr] = Cell::coordinateFromString($first); + list($fc, $fr) = Cell::coordinateFromString($first); $fc = Cell::columnIndexFromString($fc) - 1; - [$lc, $lr] = Cell::coordinateFromString($last); + list($lc, $lr) = Cell::coordinateFromString($last); $lc = Cell::columnIndexFromString($lc) - 1; // loop through the individual cells in the individual merge diff --git a/src/PhpSpreadsheet/Writer/Xls.php b/src/PhpSpreadsheet/Writer/Xls.php index ff19abc8..4252de07 100644 --- a/src/PhpSpreadsheet/Writer/Xls.php +++ b/src/PhpSpreadsheet/Writer/Xls.php @@ -448,7 +448,7 @@ class Xls extends BaseWriter implements IWriter if ($drawing instanceof Drawing) { $filename = $drawing->getPath(); - [$imagesx, $imagesy, $imageFormat] = getimagesize($filename); + list($imagesx, $imagesy, $imageFormat) = getimagesize($filename); switch ($imageFormat) { case 1: // GIF, not supported by BIFF8, we convert to PNG diff --git a/src/PhpSpreadsheet/Writer/Xls/Escher.php b/src/PhpSpreadsheet/Writer/Xls/Escher.php index 91ff8845..658a7a6d 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Escher.php +++ b/src/PhpSpreadsheet/Writer/Xls/Escher.php @@ -421,7 +421,7 @@ class Escher $recType = 0xF010; // start coordinates - [$column, $row] = Cell::coordinateFromString($this->object->getStartCoordinates()); + list($column, $row) = Cell::coordinateFromString($this->object->getStartCoordinates()); $c1 = Cell::columnIndexFromString($column) - 1; $r1 = $row - 1; @@ -432,7 +432,7 @@ class Escher $startOffsetY = $this->object->getStartOffsetY(); // end coordinates - [$column, $row] = Cell::coordinateFromString($this->object->getEndCoordinates()); + list($column, $row) = Cell::coordinateFromString($this->object->getEndCoordinates()); $c2 = Cell::columnIndexFromString($column) - 1; $r2 = $row - 1; diff --git a/src/PhpSpreadsheet/Writer/Xls/Parser.php b/src/PhpSpreadsheet/Writer/Xls/Parser.php index 92c3474a..e9150bee 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Parser.php +++ b/src/PhpSpreadsheet/Writer/Xls/Parser.php @@ -603,15 +603,15 @@ class Parser // TODO: possible class value 0,1,2 check Formula.pm // Split the range into 2 cell refs if (preg_match('/^(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)\:(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)$/', $range)) { - [$cell1, $cell2] = explode(':', $range); + list($cell1, $cell2) = explode(':', $range); } else { // TODO: use real error codes throw new WriterException('Unknown range separator'); } // Convert the cell references - [$row1, $col1] = $this->cellToPackedRowcol($cell1); - [$row2, $col2] = $this->cellToPackedRowcol($cell2); + list($row1, $col1) = $this->cellToPackedRowcol($cell1); + list($row2, $col2) = $this->cellToPackedRowcol($cell2); // The ptg value depends on the class of the ptg. if ($class == 0) { @@ -639,20 +639,20 @@ class Parser private function convertRange3d($token) { // Split the ref at the ! symbol - [$ext_ref, $range] = explode('!', $token); + list($ext_ref, $range) = explode('!', $token); // Convert the external reference part (different for BIFF8) $ext_ref = $this->getRefIndex($ext_ref); // Split the range into 2 cell refs - [$cell1, $cell2] = explode(':', $range); + list($cell1, $cell2) = explode(':', $range); // Convert the cell references if (preg_match("/^(\\$)?[A-Ia-i]?[A-Za-z](\\$)?(\d+)$/", $cell1)) { - [$row1, $col1] = $this->cellToPackedRowcol($cell1); - [$row2, $col2] = $this->cellToPackedRowcol($cell2); + list($row1, $col1) = $this->cellToPackedRowcol($cell1); + list($row2, $col2) = $this->cellToPackedRowcol($cell2); } else { // It's a rows range (like 26:27) - [$row1, $col1, $row2, $col2] = $this->rangeToPackedRange($cell1 . ':' . $cell2); + list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1 . ':' . $cell2); } // The ptg value depends on the class of the ptg. @@ -672,7 +672,7 @@ class Parser { // Convert the cell reference $cell_array = $this->cellToPackedRowcol($cell); - [$row, $col] = $cell_array; + list($row, $col) = $cell_array; // The ptg value depends on the class of the ptg. $ptgRef = pack('C', $this->ptg['ptgRefA']); @@ -691,13 +691,13 @@ class Parser private function convertRef3d($cell) { // Split the ref at the ! symbol - [$ext_ref, $cell] = explode('!', $cell); + list($ext_ref, $cell) = explode('!', $cell); // Convert the external reference part (different for BIFF8) $ext_ref = $this->getRefIndex($ext_ref); // Convert the cell reference part - [$row, $col] = $this->cellToPackedRowcol($cell); + list($row, $col) = $this->cellToPackedRowcol($cell); // The ptg value depends on the class of the ptg. $ptgRef = pack('C', $this->ptg['ptgRef3dA']); @@ -749,7 +749,7 @@ class Parser // Check if there is a sheet range eg., Sheet1:Sheet2. if (preg_match('/:/', $ext_ref)) { - [$sheet_name1, $sheet_name2] = explode(':', $ext_ref); + list($sheet_name1, $sheet_name2) = explode(':', $ext_ref); $sheet1 = $this->getSheetIndex($sheet_name1); if ($sheet1 == -1) { @@ -762,7 +762,7 @@ class Parser // Reverse max and min sheet numbers if necessary if ($sheet1 > $sheet2) { - [$sheet1, $sheet2] = [$sheet2, $sheet1]; + list($sheet1, $sheet2) = [$sheet2, $sheet1]; } } else { // Single sheet name only. $sheet1 = $this->getSheetIndex($ext_ref); @@ -795,7 +795,7 @@ class Parser // Check if there is a sheet range eg., Sheet1:Sheet2. if (preg_match('/:/', $ext_ref)) { - [$sheet_name1, $sheet_name2] = explode(':', $ext_ref); + list($sheet_name1, $sheet_name2) = explode(':', $ext_ref); $sheet1 = $this->getSheetIndex($sheet_name1); if ($sheet1 == -1) { @@ -808,7 +808,7 @@ class Parser // Reverse max and min sheet numbers if necessary if ($sheet1 > $sheet2) { - [$sheet1, $sheet2] = [$sheet2, $sheet1]; + list($sheet1, $sheet2) = [$sheet2, $sheet1]; } } else { // Single sheet name only. $sheet1 = $this->getSheetIndex($ext_ref); @@ -882,7 +882,7 @@ class Parser private function cellToPackedRowcol($cell) { $cell = strtoupper($cell); - [$row, $col, $row_rel, $col_rel] = $this->cellToRowcol($cell); + list($row, $col, $row_rel, $col_rel) = $this->cellToRowcol($cell); if ($col >= 256) { throw new WriterException("Column in: $cell greater than 255"); } diff --git a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php index 9c7f5627..387f94a4 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php @@ -478,7 +478,7 @@ class Worksheet extends BIFFwriter // Hyperlinks foreach ($phpSheet->getHyperLinkCollection() as $coordinate => $hyperlink) { - [$column, $row] = Cell::coordinateFromString($coordinate); + list($column, $row) = Cell::coordinateFromString($coordinate); $url = $hyperlink->getUrl(); @@ -1423,17 +1423,17 @@ class Worksheet extends BIFFwriter $selectedCells = Cell::splitRange($this->phpSheet->getSelectedCells()); $selectedCells = $selectedCells[0]; if (count($selectedCells) == 2) { - [$first, $last] = $selectedCells; + list($first, $last) = $selectedCells; } else { $first = $selectedCells[0]; $last = $selectedCells[0]; } - [$colFirst, $rwFirst] = Cell::coordinateFromString($first); + list($colFirst, $rwFirst) = Cell::coordinateFromString($first); $colFirst = Cell::columnIndexFromString($colFirst) - 1; // base 0 column index --$rwFirst; // base 0 row index - [$colLast, $rwLast] = Cell::coordinateFromString($last); + list($colLast, $rwLast) = Cell::coordinateFromString($last); $colLast = Cell::columnIndexFromString($colLast) - 1; // base 0 column index --$rwLast; // base 0 row index @@ -1462,11 +1462,11 @@ class Worksheet extends BIFFwriter // Swap last row/col for first row/col as necessary if ($rwFirst > $rwLast) { - [$rwFirst, $rwLast] = [$rwLast, $rwFirst]; + list($rwFirst, $rwLast) = [$rwLast, $rwFirst]; } if ($colFirst > $colLast) { - [$colFirst, $colLast] = [$colLast, $colFirst]; + list($colFirst, $colLast) = [$colLast, $colFirst]; } $header = pack('vv', $record, $length); @@ -1508,9 +1508,9 @@ class Worksheet extends BIFFwriter // extract the row and column indexes $range = Cell::splitRange($mergeCell); - [$first, $last] = $range[0]; - [$firstColumn, $firstRow] = Cell::coordinateFromString($first); - [$lastColumn, $lastRow] = Cell::coordinateFromString($last); + list($first, $last) = $range[0]; + list($firstColumn, $firstRow) = Cell::coordinateFromString($first); + list($lastColumn, $lastRow) = Cell::coordinateFromString($last); $recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, Cell::columnIndexFromString($firstColumn) - 1, Cell::columnIndexFromString($lastColumn) - 1); @@ -1710,7 +1710,7 @@ class Worksheet extends BIFFwriter { $panes = []; if ($freezePane = $this->phpSheet->getFreezePane()) { - [$column, $row] = Cell::coordinateFromString($freezePane); + list($column, $row) = Cell::coordinateFromString($freezePane); $panes[0] = $row - 1; $panes[1] = Cell::columnIndexFromString($column) - 1; } else { @@ -2331,7 +2331,7 @@ class Worksheet extends BIFFwriter public function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1) { $bitmap_array = (is_resource($bitmap) ? $this->processBitmapGd($bitmap) : $this->processBitmap($bitmap)); - [$width, $height, $size, $data] = $bitmap_array; + list($width, $height, $size, $data) = $bitmap_array; // Scale the frame of the image. $width *= $scale_x; diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Comments.php b/src/PhpSpreadsheet/Writer/Xlsx/Comments.php index 0e8ae0e0..c64e2f9e 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Comments.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Comments.php @@ -177,7 +177,7 @@ class Comments extends WriterPart private function writeVMLComment(XMLWriter $objWriter, $pCellReference, Comment $pComment) { // Metadata - [$column, $row] = Cell::coordinateFromString($pCellReference); + list($column, $row) = Cell::coordinateFromString($pCellReference); $column = Cell::columnIndexFromString($column); $id = 1024 + $column + $row; $id = substr($id, 0, 4); diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php b/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php index a763e54e..852f7c39 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php @@ -352,7 +352,7 @@ class Workbook extends WriterPart $range = $range[0]; // Strip any worksheet ref so we can make the cell ref absolute if (strpos($range[0], '!') !== false) { - [$ws, $range[0]] = explode('!', $range[0]); + list($ws, $range[0]) = explode('!', $range[0]); } $range[0] = Cell::absoluteCoordinate($range[0]); diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php b/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php index e9480998..3f3183bb 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php @@ -253,7 +253,7 @@ class Worksheet extends WriterPart // Calculate freeze coordinates $xSplit = $ySplit = 0; - [$xSplit, $ySplit] = Cell::coordinateFromString($topLeftCell); + list($xSplit, $ySplit) = Cell::coordinateFromString($topLeftCell); $xSplit = Cell::columnIndexFromString($xSplit); // pane @@ -761,7 +761,7 @@ class Worksheet extends WriterPart $range = $range[0]; // Strip any worksheet ref if (strpos($range[0], '!') !== false) { - [$ws, $range[0]] = explode('!', $range[0]); + list($ws, $range[0]) = explode('!', $range[0]); } $range = implode(':', $range); diff --git a/tests/PhpSpreadsheetTests/Custom/Complex.php b/tests/PhpSpreadsheetTests/Custom/Complex.php index 37305b03..155ca428 100644 --- a/tests/PhpSpreadsheetTests/Custom/Complex.php +++ b/tests/PhpSpreadsheetTests/Custom/Complex.php @@ -71,10 +71,10 @@ class Complex if ($imaginaryPart === null) { if (is_array($realPart)) { // We have an array of (potentially) real and imaginary parts, and any suffix - [$realPart, $imaginaryPart, $suffix] = array_values($realPart) + [0.0, 0.0, 'i']; + list($realPart, $imaginaryPart, $suffix) = array_values($realPart) + [0.0, 0.0, 'i']; } elseif ((is_string($realPart)) || (is_numeric($realPart))) { // We've been given a string to parse to extract the real and imaginary parts, and any suffix - [$realPart, $imaginaryPart, $suffix] = self::_parseComplex($realPart); + list($realPart, $imaginaryPart, $suffix) = self::_parseComplex($realPart); } }