Take advantage of PHP 7.1 syntax

This commit is contained in:
Adrien Crivelli 2019-07-24 23:43:28 -07:00
parent 454d942c13
commit 7faee3d6cc
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
39 changed files with 159 additions and 166 deletions

View File

@ -56,7 +56,7 @@ return PhpCsFixer\Config::create()
'is_null' => ['use_yoda_style' => false],
'linebreak_after_opening_tag' => true,
'line_ending' => true,
'list_syntax' => ['syntax' => 'long'], // Stay compatiblew with PHP 5.6
'list_syntax' => ['syntax' => 'short'],
'lowercase_cast' => true,
'lowercase_constants' => true,
'lowercase_keywords' => true,
@ -172,7 +172,7 @@ return PhpCsFixer\Config::create()
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => false, // Cannot use that with PHP 5.6
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,

View File

@ -2416,7 +2416,7 @@ class Calculation
// Identify our locale and language
$language = $locale = strtolower($locale);
if (strpos($locale, '_') !== false) {
list($language) = explode('_', $locale);
[$language] = explode('_', $locale);
}
if (count(self::$validLocaleLanguages) == 1) {
self::loadLocales();
@ -2441,9 +2441,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) {
list($localeFunction) = explode('##', $localeFunction); // Strip out comments
[$localeFunction] = explode('##', $localeFunction); // Strip out comments
if (strpos($localeFunction, '=') !== false) {
list($fName, $lfName) = explode('=', $localeFunction);
[$fName, $lfName] = explode('=', $localeFunction);
$fName = trim($fName);
$lfName = trim($lfName);
if ((isset(self::$phpSpreadsheetFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
@ -2466,9 +2466,9 @@ class Calculation
if (file_exists($configFile)) {
$localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($localeSettings as $localeSetting) {
list($localeSetting) = explode('##', $localeSetting); // Strip out comments
[$localeSetting] = explode('##', $localeSetting); // Strip out comments
if (strpos($localeSetting, '=') !== false) {
list($settingName, $settingValue) = explode('=', $localeSetting);
[$settingName, $settingValue] = explode('=', $localeSetting);
$settingName = strtoupper(trim($settingName));
switch ($settingName) {
case 'ARGUMENTSEPARATOR':
@ -2977,17 +2977,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)) {
list($matrixRows, $matrixColumns) = self::getMatrixDimensions($operand2);
[$matrixRows, $matrixColumns] = self::getMatrixDimensions($operand2);
$operand1 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand1));
$resize = 0;
} elseif (!is_array($operand2)) {
list($matrixRows, $matrixColumns) = self::getMatrixDimensions($operand1);
[$matrixRows, $matrixColumns] = self::getMatrixDimensions($operand1);
$operand2 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand2));
$resize = 0;
}
list($matrix1Rows, $matrix1Columns) = self::getMatrixDimensions($operand1);
list($matrix2Rows, $matrix2Columns) = self::getMatrixDimensions($operand2);
[$matrix1Rows, $matrix1Columns] = self::getMatrixDimensions($operand1);
[$matrix2Rows, $matrix2Columns] = self::getMatrixDimensions($operand2);
if (($matrix1Rows == $matrix2Columns) && ($matrix2Rows == $matrix1Columns)) {
$resize = 1;
}
@ -3496,11 +3496,11 @@ class Calculation
$testPrevOp = $stack->last(1);
if ($testPrevOp['value'] == ':') {
$startRowColRef = $output[count($output) - 1]['value'];
list($rangeWS1, $startRowColRef) = Worksheet::extractSheetTitle($startRowColRef, true);
[$rangeWS1, $startRowColRef] = Worksheet::extractSheetTitle($startRowColRef, true);
if ($rangeWS1 != '') {
$rangeWS1 .= '!';
}
list($rangeWS2, $val) = Worksheet::extractSheetTitle($val, true);
[$rangeWS2, $val] = Worksheet::extractSheetTitle($val, true);
if ($rangeWS2 != '') {
$rangeWS2 .= '!';
} else {
@ -3678,12 +3678,12 @@ class Calculation
// Binary Operators
case ':': // Range
if (strpos($operand1Data['reference'], '!') !== false) {
list($sheet1, $operand1Data['reference']) = Worksheet::extractSheetTitle($operand1Data['reference'], true);
[$sheet1, $operand1Data['reference']] = Worksheet::extractSheetTitle($operand1Data['reference'], true);
} else {
$sheet1 = ($pCellParent !== null) ? $pCellWorksheet->getTitle() : '';
}
list($sheet2, $operand2Data['reference']) = Worksheet::extractSheetTitle($operand2Data['reference'], true);
[$sheet2, $operand2Data['reference']] = Worksheet::extractSheetTitle($operand2Data['reference'], true);
if (empty($sheet2)) {
$sheet2 = $sheet1;
}
@ -4312,7 +4312,7 @@ class Calculation
if ($pSheet !== null) {
$pSheetName = $pSheet->getTitle();
if (strpos($pRange, '!') !== false) {
list($pSheetName, $pRange) = Worksheet::extractSheetTitle($pRange, true);
[$pSheetName, $pRange] = Worksheet::extractSheetTitle($pRange, true);
$pSheet = $this->spreadsheet->getSheetByName($pSheetName);
}
@ -4365,7 +4365,7 @@ class Calculation
if ($pSheet !== null) {
$pSheetName = $pSheet->getTitle();
if (strpos($pRange, '!') !== false) {
list($pSheetName, $pRange) = Worksheet::extractSheetTitle($pRange, true);
[$pSheetName, $pRange] = Worksheet::extractSheetTitle($pRange, true);
$pSheet = $this->spreadsheet->getSheetByName($pSheetName);
}
@ -4389,7 +4389,7 @@ class Calculation
$aReferences = Coordinate::extractAllCellReferencesInRange($pRange);
if (!isset($aReferences[1])) {
// Single cell (or single column or row) in range
list($currentCol, $currentRow) = Coordinate::coordinateFromString($aReferences[0]);
[$currentCol, $currentRow] = Coordinate::coordinateFromString($aReferences[0]);
if ($pSheet->cellExists($aReferences[0])) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
} else {
@ -4399,7 +4399,7 @@ class Calculation
// Extract cell data for all cells in the range
foreach ($aReferences as $reference) {
// Extract range
list($currentCol, $currentRow) = Coordinate::coordinateFromString($reference);
[$currentCol, $currentRow] = Coordinate::coordinateFromString($reference);
if ($pSheet->cellExists($reference)) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
} else {

View File

@ -281,7 +281,7 @@ class Functions
return '=' . $condition;
}
preg_match('/(=|<[>=]?|>=?)(.*)/', $condition, $matches);
list(, $operator, $operand) = $matches;
[, $operator, $operand] = $matches;
if (is_numeric(trim($operand, '"'))) {
$operand = trim($operand, '"');

View File

@ -98,9 +98,9 @@ class LookupRef
return (int) Coordinate::columnIndexFromString($columnKey);
}
} else {
list($sheet, $cellAddress) = Worksheet::extractSheetTitle($cellAddress, true);
[$sheet, $cellAddress] = Worksheet::extractSheetTitle($cellAddress, true);
if (strpos($cellAddress, ':') !== false) {
list($startAddress, $endAddress) = explode(':', $cellAddress);
[$startAddress, $endAddress] = explode(':', $cellAddress);
$startAddress = preg_replace('/[^a-z]/i', '', $startAddress);
$endAddress = preg_replace('/[^a-z]/i', '', $endAddress);
$returnValue = [];
@ -138,7 +138,7 @@ class LookupRef
reset($cellAddress);
$isMatrix = (is_numeric(key($cellAddress)));
list($columns, $rows) = Calculation::getMatrixDimensions($cellAddress);
[$columns, $rows] = Calculation::getMatrixDimensions($cellAddress);
if ($isMatrix) {
return $rows;
@ -175,9 +175,9 @@ class LookupRef
}
}
} else {
list($sheet, $cellAddress) = Worksheet::extractSheetTitle($cellAddress, true);
[$sheet, $cellAddress] = Worksheet::extractSheetTitle($cellAddress, true);
if (strpos($cellAddress, ':') !== false) {
list($startAddress, $endAddress) = explode(':', $cellAddress);
[$startAddress, $endAddress] = explode(':', $cellAddress);
$startAddress = preg_replace('/\D/', '', $startAddress);
$endAddress = preg_replace('/\D/', '', $endAddress);
$returnValue = [];
@ -187,7 +187,7 @@ class LookupRef
return $returnValue;
}
list($cellAddress) = explode(':', $cellAddress);
[$cellAddress] = explode(':', $cellAddress);
return (int) preg_replace('/\D/', '', $cellAddress);
}
@ -215,7 +215,7 @@ class LookupRef
reset($cellAddress);
$isMatrix = (is_numeric(key($cellAddress)));
list($columns, $rows) = Calculation::getMatrixDimensions($cellAddress);
[$columns, $rows] = Calculation::getMatrixDimensions($cellAddress);
if ($isMatrix) {
return $columns;
@ -285,7 +285,7 @@ class LookupRef
$cellAddress1 = $cellAddress;
$cellAddress2 = null;
if (strpos($cellAddress, ':') !== false) {
list($cellAddress1, $cellAddress2) = explode(':', $cellAddress);
[$cellAddress1, $cellAddress2] = explode(':', $cellAddress);
}
if ((!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress1, $matches)) ||
@ -295,7 +295,7 @@ class LookupRef
}
if (strpos($cellAddress, '!') !== false) {
list($sheetName, $cellAddress) = Worksheet::extractSheetTitle($cellAddress, true);
[$sheetName, $cellAddress] = Worksheet::extractSheetTitle($cellAddress, true);
$sheetName = trim($sheetName, "'");
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
} else {
@ -306,7 +306,7 @@ class LookupRef
}
if (strpos($cellAddress, '!') !== false) {
list($sheetName, $cellAddress) = Worksheet::extractSheetTitle($cellAddress, true);
[$sheetName, $cellAddress] = Worksheet::extractSheetTitle($cellAddress, true);
$sheetName = trim($sheetName, "'");
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
} else {
@ -359,16 +359,16 @@ class LookupRef
$sheetName = null;
if (strpos($cellAddress, '!')) {
list($sheetName, $cellAddress) = Worksheet::extractSheetTitle($cellAddress, true);
[$sheetName, $cellAddress] = Worksheet::extractSheetTitle($cellAddress, true);
$sheetName = trim($sheetName, "'");
}
if (strpos($cellAddress, ':')) {
list($startCell, $endCell) = explode(':', $cellAddress);
[$startCell, $endCell] = explode(':', $cellAddress);
} else {
$startCell = $endCell = $cellAddress;
}
list($startCellColumn, $startCellRow) = Coordinate::coordinateFromString($startCell);
list($endCellColumn, $endCellRow) = Coordinate::coordinateFromString($endCell);
[$startCellColumn, $startCellRow] = Coordinate::coordinateFromString($startCell);
[$endCellColumn, $endCellRow] = Coordinate::coordinateFromString($endCell);
$startCellRow += $rows;
$startCellColumn = Coordinate::columnIndexFromString($startCellColumn) - 1;

View File

@ -1074,7 +1074,7 @@ class MathTrig
return array_filter(
$args,
function ($index) use ($cellReference) {
list(, $row, $column) = explode('.', $index);
[, $row, $column] = explode('.', $index);
return $cellReference->getWorksheet()->getRowDimension($row)->getVisible() &&
$cellReference->getWorksheet()->getColumnDimension($column)->getVisible();
@ -1088,7 +1088,7 @@ class MathTrig
return array_filter(
$args,
function ($index) use ($cellReference) {
list(, $row, $column) = explode('.', $index);
[, $row, $column] = explode('.', $index);
if ($cellReference->getWorksheet()->cellExists($column . $row)) {
//take this cell out if it contains the SUBTOTAL or AGGREGATE functions in a formula
$isFormula = $cellReference->getWorksheet()->getCell($column . $row)->isFormula();

View File

@ -118,7 +118,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
list($h, $m) = explode(':', $value);
[$h, $m] = explode(':', $value);
$days = $h / 24 + $m / 1440;
$cell->setValueExplicit($days, DataType::TYPE_NUMERIC);
// Set style
@ -131,7 +131,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
list($h, $m, $s) = explode(':', $value);
[$h, $m, $s] = explode(':', $value);
$days = $h / 24 + $m / 1440 + $s / 86400;
// Convert value to number
$cell->setValueExplicit($days, DataType::TYPE_NUMERIC);

View File

@ -511,7 +511,7 @@ class Cell
{
if ($mergeRange = $this->getMergeRange()) {
$mergeRange = Coordinate::splitRange($mergeRange);
list($startCell) = $mergeRange[0];
[$startCell] = $mergeRange[0];
if ($this->getCoordinate() === $startCell) {
return true;
}
@ -569,7 +569,7 @@ class Cell
*/
public function isInRange($pRange)
{
list($rangeStart, $rangeEnd) = Coordinate::rangeBoundaries($pRange);
[$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($pRange);
// Translate properties
$myColumn = Coordinate::columnIndexFromString($this->getColumn());

View File

@ -71,7 +71,7 @@ abstract class Coordinate
}
// Split out any worksheet name from the reference
list($worksheet, $pCoordinateString) = Worksheet::extractSheetTitle($pCoordinateString, true);
[$worksheet, $pCoordinateString] = Worksheet::extractSheetTitle($pCoordinateString, true);
if ($worksheet > '') {
$worksheet .= '!';
}
@ -102,13 +102,13 @@ abstract class Coordinate
}
// Split out any worksheet name from the coordinate
list($worksheet, $pCoordinateString) = Worksheet::extractSheetTitle($pCoordinateString, true);
[$worksheet, $pCoordinateString] = Worksheet::extractSheetTitle($pCoordinateString, true);
if ($worksheet > '') {
$worksheet .= '!';
}
// Create absolute coordinate
list($column, $row) = self::coordinateFromString($pCoordinateString);
[$column, $row] = self::coordinateFromString($pCoordinateString);
$column = ltrim($column, '$');
$row = ltrim($row, '$');
@ -187,7 +187,7 @@ abstract class Coordinate
if (strpos($pRange, ':') === false) {
$rangeA = $rangeB = $pRange;
} else {
list($rangeA, $rangeB) = explode(':', $pRange);
[$rangeA, $rangeB] = explode(':', $pRange);
}
// Calculate range outer borders
@ -211,7 +211,7 @@ abstract class Coordinate
public static function rangeDimension($pRange)
{
// Calculate range outer borders
list($rangeStart, $rangeEnd) = self::rangeBoundaries($pRange);
[$rangeStart, $rangeEnd] = self::rangeBoundaries($pRange);
return [($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1)];
}
@ -238,7 +238,7 @@ abstract class Coordinate
if (strpos($pRange, ':') === false) {
$rangeA = $rangeB = $pRange;
} else {
list($rangeA, $rangeB) = explode(':', $pRange);
[$rangeA, $rangeB] = explode(':', $pRange);
}
return [self::coordinateFromString($rangeA), self::coordinateFromString($rangeB)];
@ -376,9 +376,9 @@ abstract class Coordinate
}
// Range...
list($rangeStart, $rangeEnd) = $range;
list($startColumn, $startRow) = self::coordinateFromString($rangeStart);
list($endColumn, $endRow) = self::coordinateFromString($rangeEnd);
[$rangeStart, $rangeEnd] = $range;
[$startColumn, $startRow] = self::coordinateFromString($rangeStart);
[$endColumn, $endRow] = self::coordinateFromString($rangeEnd);
$startColumnIndex = self::columnIndexFromString($startColumn);
$endColumnIndex = self::columnIndexFromString($endColumn);
++$endColumnIndex;
@ -432,7 +432,7 @@ abstract class Coordinate
continue;
}
list($column, $row) = self::coordinateFromString($coord);
[$column, $row] = self::coordinateFromString($coord);
$row = (int) (ltrim($row, '$'));
$hashCode = $column . '-' . (is_object($value) ? $value->getHashCode() : $value);

View File

@ -376,7 +376,7 @@ class DataSeriesValues
}
unset($dataValue);
} else {
list($worksheet, $cellRange) = Worksheet::extractSheetTitle($this->dataSource, true);
[$worksheet, $cellRange] = Worksheet::extractSheetTitle($this->dataSource, true);
$dimensions = Coordinate::rangeDimension(str_replace('$', '', $cellRange));
if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
$this->dataValues = Functions::flattenArray($newDataValues);

View File

@ -442,7 +442,7 @@ class JpGraph implements IRenderer
$seriesPlot->link->SetColor(self::$colourSet[self::$plotColour]);
} elseif ($scatterStyle == 'smoothMarker') {
$spline = new \Spline($dataValuesY, $dataValuesX);
list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$width / 20);
[$splineDataY, $splineDataX] = $spline->Get(count($dataValuesX) * self::$width / 20);
$lplot = new \LinePlot($splineDataX, $splineDataY);
$lplot->SetColor(self::$colourSet[self::$plotColour]);

View File

@ -175,9 +175,8 @@ class Csv extends BaseReader
}
}
foreach ($potentialDelimiters as $delimiter) {
$counts[$delimiter][] = isset($countLine[$delimiter])
? $countLine[$delimiter]
: 0;
$counts[$delimiter][] = $countLine[$delimiter]
?? 0;
}
}

View File

@ -267,7 +267,7 @@ class Gnumeric extends BaseReader
break;
case 'user-defined':
list(, $attrName) = explode(':', $attributes['name']);
[, $attrName] = explode(':', $attributes['name']);
switch ($attrName) {
case 'publisher':
$docProps->setCompany(trim($propertyValue));
@ -879,7 +879,7 @@ class Gnumeric extends BaseReader
private static function parseGnumericColour($gnmColour)
{
list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour);
[$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);

View File

@ -920,7 +920,7 @@ class Html extends BaseReader
*/
private function setBorderStyle(Style $cellStyle, $styleValue, $type)
{
list(, $borderStyle, $color) = explode(' ', $styleValue);
[, $borderStyle, $color] = explode(' ', $styleValue);
$cellStyle->applyFromArray([
'borders' => [

View File

@ -490,7 +490,7 @@ class Ods extends BaseReader
$dateObj = new DateTime($value, $GMT);
$dateObj->setTimeZone($timezoneObj);
list($year, $month, $day, $hour, $minute, $second) = explode(
[$year, $month, $day, $hour, $minute, $second] = explode(
' ',
$dateObj->format('Y m d H i s')
);

View File

@ -384,7 +384,7 @@ class Slk extends BaseReader
break;
case 'W':
list($startCol, $endCol, $columnWidth) = explode(' ', substr($rowDatum, 1));
[$startCol, $endCol, $columnWidth] = explode(' ', substr($rowDatum, 1));
break;
case 'S':

View File

@ -1089,8 +1089,8 @@ class Xls extends BaseReader
}
// calculate the width and height of the shape
list($startColumn, $startRow) = Coordinate::coordinateFromString($spContainer->getStartCoordinates());
list($endColumn, $endRow) = Coordinate::coordinateFromString($spContainer->getEndCoordinates());
[$startColumn, $startRow] = Coordinate::coordinateFromString($spContainer->getStartCoordinates());
[$endColumn, $endRow] = Coordinate::coordinateFromString($spContainer->getEndCoordinates());
$startOffsetX = $spContainer->getStartOffsetX();
$startOffsetY = $spContainer->getStartOffsetY();
@ -1175,7 +1175,7 @@ class Xls extends BaseReader
// treat SHAREDFMLA records
if ($this->version == self::XLS_BIFF8) {
foreach ($this->sharedFormulaParts as $cell => $baseCell) {
list($column, $row) = Coordinate::coordinateFromString($cell);
[$column, $row] = Coordinate::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, DataType::TYPE_FORMULA);
@ -1251,8 +1251,8 @@ class Xls extends BaseReader
$coordinateStrings = explode(':', $extractedRange);
if (count($coordinateStrings) == 2) {
list($firstColumn, $firstRow) = Coordinate::coordinateFromString($coordinateStrings[0]);
list($lastColumn, $lastRow) = Coordinate::coordinateFromString($coordinateStrings[1]);
[$firstColumn, $firstRow] = Coordinate::coordinateFromString($coordinateStrings[0]);
[$lastColumn, $lastRow] = Coordinate::coordinateFromString($coordinateStrings[1]);
if ($firstColumn == 'A' and $lastColumn == 'IV') {
// then we have repeating rows
@ -5355,12 +5355,12 @@ class Xls extends BaseReader
$formulaStrings = [];
foreach ($tokens as $token) {
// initialize spaces
$space0 = isset($space0) ? $space0 : ''; // spaces before next token, not tParen
$space1 = isset($space1) ? $space1 : ''; // carriage returns before next token, not tParen
$space2 = isset($space2) ? $space2 : ''; // spaces before opening parenthesis
$space3 = isset($space3) ? $space3 : ''; // carriage returns before opening parenthesis
$space4 = isset($space4) ? $space4 : ''; // spaces before closing parenthesis
$space5 = isset($space5) ? $space5 : ''; // carriage returns before closing parenthesis
$space0 = $space0 ?? ''; // spaces before next token, not tParen
$space1 = $space1 ?? ''; // carriage returns before next token, not tParen
$space2 = $space2 ?? ''; // spaces before opening parenthesis
$space3 = $space3 ?? ''; // carriage returns before opening parenthesis
$space4 = $space4 ?? ''; // spaces before closing parenthesis
$space5 = $space5 ?? ''; // carriage returns before closing parenthesis
switch ($token['name']) {
case 'tAdd': // addition
@ -7145,7 +7145,7 @@ class Xls extends BaseReader
*/
private function readBIFF8CellAddressB($cellAddressStructure, $baseCell = 'A1')
{
list($baseCol, $baseRow) = Coordinate::coordinateFromString($baseCell);
[$baseCol, $baseRow] = Coordinate::coordinateFromString($baseCell);
$baseCol = Coordinate::columnIndexFromString($baseCol) - 1;
// offset: 0; size: 2; index to row (0... 65535) (or offset (-32768... 32767))
@ -7328,7 +7328,7 @@ class Xls extends BaseReader
*/
private function readBIFF8CellRangeAddressB($subData, $baseCell = 'A1')
{
list($baseCol, $baseRow) = Coordinate::coordinateFromString($baseCell);
[$baseCol, $baseRow] = Coordinate::coordinateFromString($baseCell);
$baseCol = Coordinate::columnIndexFromString($baseCol) - 1;
// TODO: if cell range is just a single cell, should this funciton

View File

@ -1352,7 +1352,7 @@ class Xlsx extends BaseReader
$rangeSets = preg_split("/('?(?:.*?)'?(?:![A-Z0-9]+:[A-Z0-9]+)),?/", $extractedRange, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
$newRangeSets = [];
foreach ($rangeSets as $rangeSet) {
list($sheetName, $rangeSet) = Worksheet::extractSheetTitle($rangeSet, true);
[$sheetName, $rangeSet] = Worksheet::extractSheetTitle($rangeSet, true);
if (strpos($rangeSet, ':') === false) {
$rangeSet = $rangeSet . ':' . $rangeSet;
}
@ -1426,7 +1426,7 @@ class Xlsx extends BaseReader
$locatedSheet = $excel->getSheetByName($extractedSheetName);
// Modify range
list($worksheetName, $extractedRange) = Worksheet::extractSheetTitle($extractedRange, true);
[$worksheetName, $extractedRange] = Worksheet::extractSheetTitle($extractedRange, true);
}
if ($locatedSheet !== null) {
@ -1841,7 +1841,7 @@ class Xlsx extends BaseReader
private static function getArrayItem($array, $key = 0)
{
return isset($array[$key]) ? $array[$key] : null;
return $array[$key] ?? null;
}
private static function dirAdd($base, $add)

View File

@ -86,6 +86,6 @@ class Properties
private static function getArrayItem(array $array, $key = 0)
{
return isset($array[$key]) ? $array[$key] : null;
return $array[$key] ?? null;
}
}

View File

@ -260,6 +260,6 @@ class Styles extends BaseParserClass
private static function getArrayItem($array, $key = 0)
{
return isset($array[$key]) ? $array[$key] : null;
return $array[$key] ?? null;
}
}

View File

@ -82,11 +82,8 @@ class ReferenceHelper
*/
public static function cellSort($a, $b)
{
// TODO Scrutinizer doesn't like sscanf($a, '%[A-Z]%d', $ac, $ar), and we can't use short list() syntax
// [$ac, $ar] = sscanf($a, '%[A-Z]%d') while retaining PHP 5.6 support.
// Switch when we drop support for 5.6
list($ac, $ar) = sscanf($a, '%[A-Z]%d');
list($bc, $br) = sscanf($b, '%[A-Z]%d');
[$ac, $ar] = sscanf($a, '%[A-Z]%d');
[$bc, $br] = sscanf($b, '%[A-Z]%d');
if ($ar === $br) {
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
@ -106,11 +103,8 @@ class ReferenceHelper
*/
public static function cellReverseSort($a, $b)
{
// TODO Scrutinizer doesn't like sscanf($a, '%[A-Z]%d', $ac, $ar), and we can't use short list() syntax
// [$ac, $ar] = sscanf($a, '%[A-Z]%d') while retaining PHP 5.6 support.
// Switch when we drop support for 5.6
list($ac, $ar) = sscanf($a, '%[A-Z]%d');
list($bc, $br) = sscanf($b, '%[A-Z]%d');
[$ac, $ar] = sscanf($a, '%[A-Z]%d');
[$bc, $br] = sscanf($b, '%[A-Z]%d');
if ($ar === $br) {
return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
@ -132,7 +126,7 @@ class ReferenceHelper
*/
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)
{
list($cellColumn, $cellRow) = Coordinate::coordinateFromString($cellAddress);
[$cellColumn, $cellRow] = Coordinate::coordinateFromString($cellAddress);
$cellColumnIndex = Coordinate::columnIndexFromString($cellColumn);
// Is cell within the range of rows/columns if we're deleting
if ($pNumRows < 0 &&
@ -319,7 +313,7 @@ class ReferenceHelper
if (!empty($aColumnDimensions)) {
foreach ($aColumnDimensions as $objColumnDimension) {
$newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows);
list($newReference) = Coordinate::coordinateFromString($newReference);
[$newReference] = Coordinate::coordinateFromString($newReference);
if ($objColumnDimension->getColumnIndex() != $newReference) {
$objColumnDimension->setColumnIndex($newReference);
}
@ -344,7 +338,7 @@ class ReferenceHelper
if (!empty($aRowDimensions)) {
foreach ($aRowDimensions as $objRowDimension) {
$newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows);
list(, $newReference) = Coordinate::coordinateFromString($newReference);
[, $newReference] = Coordinate::coordinateFromString($newReference);
if ($objRowDimension->getRowIndex() != $newReference) {
$objRowDimension->setRowIndex($newReference);
}
@ -378,7 +372,7 @@ class ReferenceHelper
$allCoordinates = $pSheet->getCoordinates();
// Get coordinate of $pBefore
list($beforeColumn, $beforeRow) = Coordinate::coordinateFromString($pBefore);
[$beforeColumn, $beforeRow] = Coordinate::coordinateFromString($pBefore);
$beforeColumnIndex = Coordinate::columnIndexFromString($beforeColumn);
// Clear cells if we are removing columns or rows
@ -539,7 +533,7 @@ class ReferenceHelper
$row = 0;
sscanf($pBefore, '%[A-Z]%d', $column, $row);
$columnIndex = Coordinate::columnIndexFromString($column);
list($rangeStart, $rangeEnd) = Coordinate::rangeBoundaries($autoFilterRange);
[$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($autoFilterRange);
if ($columnIndex <= $rangeEnd[0]) {
if ($pNumCols < 0) {
// If we're actually deleting any columns that fall within the autofilter range,
@ -707,7 +701,7 @@ class ReferenceHelper
if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
$toString = ($match[2] > '') ? $match[2] . '!' : '';
$toString .= $modified3 . ':' . $modified4;
list($column, $row) = Coordinate::coordinateFromString($match[3]);
[$column, $row] = Coordinate::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 = Coordinate::columnIndexFromString(trim($column, '$')) + 100000;
$row = trim($row, '$') + 10000000;
@ -733,7 +727,7 @@ class ReferenceHelper
if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
$toString = ($match[2] > '') ? $match[2] . '!' : '';
$toString .= $modified3;
list($column, $row) = Coordinate::coordinateFromString($match[3]);
[$column, $row] = Coordinate::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 = Coordinate::columnIndexFromString(trim($column, '$')) + 100000;
$row = trim($row, '$') + 10000000;
@ -881,10 +875,10 @@ class ReferenceHelper
}
// Get coordinate of $pBefore
list($beforeColumn, $beforeRow) = Coordinate::coordinateFromString($pBefore);
[$beforeColumn, $beforeRow] = Coordinate::coordinateFromString($pBefore);
// Get coordinate of $pCellReference
list($newColumn, $newRow) = Coordinate::coordinateFromString($pCellReference);
[$newColumn, $newRow] = Coordinate::coordinateFromString($pCellReference);
// Verify which parts should be updated
$updateColumn = (($newColumn[0] != '$') && ($beforeColumn[0] != '$') && (Coordinate::columnIndexFromString($newColumn) >= Coordinate::columnIndexFromString($beforeColumn)));

View File

@ -174,7 +174,7 @@ class Matrix
switch ($match) {
//A($i0...; $j0...)
case 'integer,integer':
list($i0, $j0) = $args;
[$i0, $j0] = $args;
if ($i0 >= 0) {
$m = $this->m - $i0;
} else {
@ -197,7 +197,7 @@ class Matrix
break;
//A($i0...$iF; $j0...$jF)
case 'integer,integer,integer,integer':
list($i0, $iF, $j0, $jF) = $args;
[$i0, $iF, $j0, $jF] = $args;
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
$m = $iF - $i0;
} else {
@ -220,7 +220,7 @@ class Matrix
break;
//$R = array of row indices; $C = array of column indices
case 'array,array':
list($RL, $CL) = $args;
[$RL, $CL] = $args;
if (count($RL) > 0) {
$m = count($RL);
} else {
@ -243,7 +243,7 @@ class Matrix
break;
//A($i0...$iF); $CL = array of column indices
case 'integer,integer,array':
list($i0, $iF, $CL) = $args;
[$i0, $iF, $CL] = $args;
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
$m = $iF - $i0;
} else {
@ -266,7 +266,7 @@ class Matrix
break;
//$RL = array of row indices
case 'array,integer,integer':
list($RL, $j0, $jF) = $args;
[$RL, $j0, $jF] = $args;
if (count($RL) > 0) {
$m = count($RL);
} else {

View File

@ -253,7 +253,7 @@ class OLE
*/
private static function _readInt1($fh)
{
list(, $tmp) = unpack('c', fread($fh, 1));
[, $tmp] = unpack('c', fread($fh, 1));
return $tmp;
}
@ -267,7 +267,7 @@ class OLE
*/
private static function _readInt2($fh)
{
list(, $tmp) = unpack('v', fread($fh, 2));
[, $tmp] = unpack('v', fread($fh, 2));
return $tmp;
}
@ -281,7 +281,7 @@ class OLE
*/
private static function _readInt4($fh)
{
list(, $tmp) = unpack('V', fread($fh, 4));
[, $tmp] = unpack('V', fread($fh, 4));
return $tmp;
}

View File

@ -118,7 +118,7 @@ class Root extends PPS
$aList = [];
PPS::_savePpsSetPnt($aList, [$this]);
// calculate values for header
list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo);
[$iSBDcnt, $iBBcnt, $iPPScnt] = $this->_calcSize($aList); //, $rhInfo);
// Save Header
$this->_saveHeader($iSBDcnt, $iBBcnt, $iPPScnt);
@ -149,7 +149,7 @@ class Root extends PPS
public function _calcSize(&$raList)
{
// Calculate Basic Setting
list($iSBDcnt, $iBBcnt, $iPPScnt) = [0, 0, 0];
[$iSBDcnt, $iBBcnt, $iPPScnt] = [0, 0, 0];
$iSmallLen = 0;
$iSBcnt = 0;
$iCount = count($raList);

View File

@ -211,7 +211,7 @@ class Xls
*/
public static function oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height)
{
list($column, $row) = Coordinate::coordinateFromString($coordinates);
[$column, $row] = Coordinate::coordinateFromString($coordinates);
$col_start = Coordinate::columnIndexFromString($column);
$row_start = $row - 1;

View File

@ -706,7 +706,7 @@ class NumberFormat extends Supervisor
if (preg_match('/\[\$(.*)\]/u', $format, $m)) {
// Currency or Accounting
$currencyCode = $m[1];
list($currencyCode) = explode('-', $currencyCode);
[$currencyCode] = explode('-', $currencyCode);
if ($currencyCode == '') {
$currencyCode = StringHelper::getCurrencyCode();
}
@ -807,7 +807,7 @@ class NumberFormat extends Supervisor
// Additional formatting provided by callback function
if ($callBack !== null) {
list($writerInstance, $function) = $callBack;
[$writerInstance, $function] = $callBack;
$value = $writerInstance->$function($value, $formatColor);
}

View File

@ -204,7 +204,7 @@ class Style extends Supervisor
$rangeA = $pRange;
$rangeB = $pRange;
} else {
list($rangeA, $rangeB) = explode(':', $pRange);
[$rangeA, $rangeB] = explode(':', $pRange);
}
// Calculate range outer borders

View File

@ -90,7 +90,7 @@ class AutoFilter
public function setRange($pRange)
{
// extract coordinate
list($worksheet, $pRange) = Worksheet::extractSheetTitle($pRange, true);
[$worksheet, $pRange] = Worksheet::extractSheetTitle($pRange, true);
if (strpos($pRange, ':') !== false) {
$this->range = $pRange;
@ -105,7 +105,7 @@ class AutoFilter
$this->columns = [];
} else {
// Discard any column rules that are no longer valid within this range
list($rangeStart, $rangeEnd) = Coordinate::rangeBoundaries($this->range);
[$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($this->range);
foreach ($this->columns as $key => $value) {
$colIndex = Coordinate::columnIndexFromString($key);
if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) {
@ -143,7 +143,7 @@ class AutoFilter
}
$columnIndex = Coordinate::columnIndexFromString($column);
list($rangeStart, $rangeEnd) = Coordinate::rangeBoundaries($this->range);
[$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($this->range);
if (($rangeStart[0] > $columnIndex) || ($rangeEnd[0] < $columnIndex)) {
throw new PhpSpreadsheetException('Column is outside of current autofilter range.');
}
@ -196,7 +196,7 @@ class AutoFilter
*/
public function getColumnByOffset($pColumnOffset)
{
list($rangeStart, $rangeEnd) = Coordinate::rangeBoundaries($this->range);
[$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($this->range);
$pColumn = Coordinate::stringFromColumnIndex($rangeStart[0] + $pColumnOffset);
return $this->getColumn($pColumn);
@ -357,7 +357,7 @@ class AutoFilter
{
$dataSet = $ruleSet['filterRules'];
$join = $ruleSet['join'];
$customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : false;
$customRuleForBlanks = $ruleSet['customRuleForBlanks'] ?? false;
if (!$customRuleForBlanks) {
// Blank cells are always ignored, so return a FALSE
@ -621,7 +621,7 @@ class AutoFilter
*/
public function showHideRows()
{
list($rangeStart, $rangeEnd) = Coordinate::rangeBoundaries($this->range);
[$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($this->range);
// The heading row should always be visible
$this->workSheet->getRowDimension($rangeStart[1])->setVisible(true);

View File

@ -88,7 +88,7 @@ class Drawing extends BaseDrawing
if ($this->width == 0 && $this->height == 0) {
// Get width/height
list($this->width, $this->height) = getimagesize($pValue);
[$this->width, $this->height] = getimagesize($pValue);
}
} else {
throw new PhpSpreadsheetException("File $pValue not found!");

View File

@ -1561,7 +1561,7 @@ class Worksheet implements IComparable
}
// Calculate range outer borders
list($rangeStart, $rangeEnd) = Coordinate::rangeBoundaries($pRange . ':' . $pRange);
[$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($pRange . ':' . $pRange);
// Make sure we can loop upwards on rows and columns
if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) {
@ -1601,7 +1601,7 @@ class Worksheet implements IComparable
}
// Calculate range outer borders
list($rangeStart, $rangeEnd) = Coordinate::rangeBoundaries($pRange . ':' . $pRange);
[$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($pRange . ':' . $pRange);
// Make sure we can loop upwards on rows and columns
if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) {
@ -2424,7 +2424,7 @@ class Worksheet implements IComparable
$pCoordinate = preg_replace('/^(\d+):(\d+)$/', 'A${1}:XFD${2}', $pCoordinate);
if (Coordinate::coordinateIsRange($pCoordinate)) {
list($first) = Coordinate::splitRange($pCoordinate);
[$first] = Coordinate::splitRange($pCoordinate);
$this->activeCell = $first[0];
} else {
$this->activeCell = $pCoordinate;
@ -2493,7 +2493,7 @@ class Worksheet implements IComparable
}
// start coordinate
list($startColumn, $startRow) = Coordinate::coordinateFromString($startCell);
[$startColumn, $startRow] = Coordinate::coordinateFromString($startCell);
// Loop through $source
foreach ($source as $rowData) {
@ -2535,7 +2535,7 @@ class Worksheet implements IComparable
// Returnvalue
$returnValue = [];
// Identify the range that we need to extract from the worksheet
list($rangeStart, $rangeEnd) = Coordinate::rangeBoundaries($pRange);
[$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($pRange);
$minCol = Coordinate::stringFromColumnIndex($rangeStart[0]);
$minRow = $rangeStart[1];
$maxCol = Coordinate::stringFromColumnIndex($rangeEnd[0]);

View File

@ -1541,14 +1541,14 @@ class Html extends BaseWriter
// loop through all Excel merged cells
foreach ($sheet->getMergeCells() as $cells) {
list($cells) = Coordinate::splitRange($cells);
[$cells] = Coordinate::splitRange($cells);
$first = $cells[0];
$last = $cells[1];
list($fc, $fr) = Coordinate::coordinateFromString($first);
[$fc, $fr] = Coordinate::coordinateFromString($first);
$fc = Coordinate::columnIndexFromString($fc) - 1;
list($lc, $lr) = Coordinate::coordinateFromString($last);
[$lc, $lr] = Coordinate::coordinateFromString($last);
$lc = Coordinate::columnIndexFromString($lc) - 1;
// loop through the individual cells in the individual merge

View File

@ -383,7 +383,7 @@ class Content extends WriterPart
}
$mergeRange = Coordinate::splitRange($cell->getMergeRange());
list($startCell, $endCell) = $mergeRange[0];
[$startCell, $endCell] = $mergeRange[0];
$start = Coordinate::coordinateFromString($startCell);
$end = Coordinate::coordinateFromString($endCell);
$columnSpan = Coordinate::columnIndexFromString($end[0]) - Coordinate::columnIndexFromString($start[0]) + 1;

View File

@ -459,7 +459,7 @@ class Xls extends BaseWriter
if ($drawing instanceof Drawing) {
$filename = $drawing->getPath();
list($imagesx, $imagesy, $imageFormat) = getimagesize($filename);
[$imagesx, $imagesy, $imageFormat] = getimagesize($filename);
switch ($imageFormat) {
case 1: // GIF, not supported by BIFF8, we convert to PNG

View File

@ -420,7 +420,7 @@ class Escher
$recType = 0xF010;
// start coordinates
list($column, $row) = Coordinate::coordinateFromString($this->object->getStartCoordinates());
[$column, $row] = Coordinate::coordinateFromString($this->object->getStartCoordinates());
$c1 = Coordinate::columnIndexFromString($column) - 1;
$r1 = $row - 1;
@ -431,7 +431,7 @@ class Escher
$startOffsetY = $this->object->getStartOffsetY();
// end coordinates
list($column, $row) = Coordinate::coordinateFromString($this->object->getEndCoordinates());
[$column, $row] = Coordinate::coordinateFromString($this->object->getEndCoordinates());
$c2 = Coordinate::columnIndexFromString($column) - 1;
$r2 = $row - 1;

View File

@ -608,15 +608,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)) {
list($cell1, $cell2) = explode(':', $range);
[$cell1, $cell2] = explode(':', $range);
} else {
// TODO: use real error codes
throw new WriterException('Unknown range separator');
}
// Convert the cell references
list($row1, $col1) = $this->cellToPackedRowcol($cell1);
list($row2, $col2) = $this->cellToPackedRowcol($cell2);
[$row1, $col1] = $this->cellToPackedRowcol($cell1);
[$row2, $col2] = $this->cellToPackedRowcol($cell2);
// The ptg value depends on the class of the ptg.
if ($class == 0) {
@ -644,20 +644,20 @@ class Parser
private function convertRange3d($token)
{
// Split the ref at the ! symbol
list($ext_ref, $range) = PhpspreadsheetWorksheet::extractSheetTitle($token, true);
[$ext_ref, $range] = PhpspreadsheetWorksheet::extractSheetTitle($token, true);
// Convert the external reference part (different for BIFF8)
$ext_ref = $this->getRefIndex($ext_ref);
// Split the range into 2 cell refs
list($cell1, $cell2) = explode(':', $range);
[$cell1, $cell2] = explode(':', $range);
// Convert the cell references
if (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\\d+)$/', $cell1)) {
list($row1, $col1) = $this->cellToPackedRowcol($cell1);
list($row2, $col2) = $this->cellToPackedRowcol($cell2);
[$row1, $col1] = $this->cellToPackedRowcol($cell1);
[$row2, $col2] = $this->cellToPackedRowcol($cell2);
} else { // It's a rows range (like 26:27)
list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1 . ':' . $cell2);
[$row1, $col1, $row2, $col2] = $this->rangeToPackedRange($cell1 . ':' . $cell2);
}
// The ptg value depends on the class of the ptg.
@ -677,7 +677,7 @@ class Parser
{
// Convert the cell reference
$cell_array = $this->cellToPackedRowcol($cell);
list($row, $col) = $cell_array;
[$row, $col] = $cell_array;
// The ptg value depends on the class of the ptg.
$ptgRef = pack('C', $this->ptg['ptgRefA']);
@ -696,13 +696,13 @@ class Parser
private function convertRef3d($cell)
{
// Split the ref at the ! symbol
list($ext_ref, $cell) = PhpspreadsheetWorksheet::extractSheetTitle($cell, true);
[$ext_ref, $cell] = PhpspreadsheetWorksheet::extractSheetTitle($cell, true);
// Convert the external reference part (different for BIFF8)
$ext_ref = $this->getRefIndex($ext_ref);
// Convert the cell reference part
list($row, $col) = $this->cellToPackedRowcol($cell);
[$row, $col] = $this->cellToPackedRowcol($cell);
// The ptg value depends on the class of the ptg.
$ptgRef = pack('C', $this->ptg['ptgRef3dA']);
@ -756,7 +756,7 @@ class Parser
// Check if there is a sheet range eg., Sheet1:Sheet2.
if (preg_match('/:/', $ext_ref)) {
list($sheet_name1, $sheet_name2) = explode(':', $ext_ref);
[$sheet_name1, $sheet_name2] = explode(':', $ext_ref);
$sheet1 = $this->getSheetIndex($sheet_name1);
if ($sheet1 == -1) {
@ -769,7 +769,7 @@ class Parser
// Reverse max and min sheet numbers if necessary
if ($sheet1 > $sheet2) {
list($sheet1, $sheet2) = [$sheet2, $sheet1];
[$sheet1, $sheet2] = [$sheet2, $sheet1];
}
} else { // Single sheet name only.
$sheet1 = $this->getSheetIndex($ext_ref);
@ -843,7 +843,7 @@ class Parser
private function cellToPackedRowcol($cell)
{
$cell = strtoupper($cell);
list($row, $col, $row_rel, $col_rel) = $this->cellToRowcol($cell);
[$row, $col, $row_rel, $col_rel] = $this->cellToRowcol($cell);
if ($col >= 256) {
throw new WriterException("Column in: $cell greater than 255");
}
@ -1078,7 +1078,7 @@ class Parser
{
$this->currentCharacter = 0;
$this->formula = $formula;
$this->lookAhead = isset($formula[1]) ? $formula[1] : '';
$this->lookAhead = $formula[1] ?? '';
$this->advance();
$this->parseTree = $this->condition();

View File

@ -479,7 +479,7 @@ class Worksheet extends BIFFwriter
// Hyperlinks
foreach ($phpSheet->getHyperLinkCollection() as $coordinate => $hyperlink) {
list($column, $row) = Coordinate::coordinateFromString($coordinate);
[$column, $row] = Coordinate::coordinateFromString($coordinate);
$url = $hyperlink->getUrl();
@ -1355,17 +1355,17 @@ class Worksheet extends BIFFwriter
$selectedCells = Coordinate::splitRange($this->phpSheet->getSelectedCells());
$selectedCells = $selectedCells[0];
if (count($selectedCells) == 2) {
list($first, $last) = $selectedCells;
[$first, $last] = $selectedCells;
} else {
$first = $selectedCells[0];
$last = $selectedCells[0];
}
list($colFirst, $rwFirst) = Coordinate::coordinateFromString($first);
[$colFirst, $rwFirst] = Coordinate::coordinateFromString($first);
$colFirst = Coordinate::columnIndexFromString($colFirst) - 1; // base 0 column index
--$rwFirst; // base 0 row index
list($colLast, $rwLast) = Coordinate::coordinateFromString($last);
[$colLast, $rwLast] = Coordinate::coordinateFromString($last);
$colLast = Coordinate::columnIndexFromString($colLast) - 1; // base 0 column index
--$rwLast; // base 0 row index
@ -1394,11 +1394,11 @@ class Worksheet extends BIFFwriter
// Swap last row/col for first row/col as necessary
if ($rwFirst > $rwLast) {
list($rwFirst, $rwLast) = [$rwLast, $rwFirst];
[$rwFirst, $rwLast] = [$rwLast, $rwFirst];
}
if ($colFirst > $colLast) {
list($colFirst, $colLast) = [$colLast, $colFirst];
[$colFirst, $colLast] = [$colLast, $colFirst];
}
$header = pack('vv', $record, $length);
@ -1440,9 +1440,9 @@ class Worksheet extends BIFFwriter
// extract the row and column indexes
$range = Coordinate::splitRange($mergeCell);
list($first, $last) = $range[0];
list($firstColumn, $firstRow) = Coordinate::coordinateFromString($first);
list($lastColumn, $lastRow) = Coordinate::coordinateFromString($last);
[$first, $last] = $range[0];
[$firstColumn, $firstRow] = Coordinate::coordinateFromString($first);
[$lastColumn, $lastRow] = Coordinate::coordinateFromString($last);
$recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, Coordinate::columnIndexFromString($firstColumn) - 1, Coordinate::columnIndexFromString($lastColumn) - 1);
@ -1589,11 +1589,11 @@ class Worksheet extends BIFFwriter
{
$panes = [];
if ($this->phpSheet->getFreezePane()) {
list($column, $row) = Coordinate::coordinateFromString($this->phpSheet->getFreezePane());
[$column, $row] = Coordinate::coordinateFromString($this->phpSheet->getFreezePane());
$panes[0] = Coordinate::columnIndexFromString($column) - 1;
$panes[1] = $row - 1;
list($leftMostColumn, $topRow) = Coordinate::coordinateFromString($this->phpSheet->getTopLeftCell());
[$leftMostColumn, $topRow] = Coordinate::coordinateFromString($this->phpSheet->getTopLeftCell());
//Coordinates are zero-based in xls files
$panes[2] = $topRow - 1;
$panes[3] = Coordinate::columnIndexFromString($leftMostColumn) - 1;
@ -1602,10 +1602,10 @@ class Worksheet extends BIFFwriter
return;
}
$x = isset($panes[0]) ? $panes[0] : null;
$y = isset($panes[1]) ? $panes[1] : null;
$rwTop = isset($panes[2]) ? $panes[2] : null;
$colLeft = isset($panes[3]) ? $panes[3] : null;
$x = $panes[0] ?? null;
$y = $panes[1] ?? null;
$rwTop = $panes[2] ?? null;
$colLeft = $panes[3] ?? null;
if (count($panes) > 4) { // if Active pane was received
$pnnAct = $panes[4];
} else {
@ -2215,7 +2215,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));
list($width, $height, $size, $data) = $bitmap_array;
[$width, $height, $size, $data] = $bitmap_array;
// Scale the frame of the image.
$width *= $scale_x;

View File

@ -1136,7 +1136,7 @@ class Chart extends WriterPart
$fillColorValues = $plotSeriesValues->getFillColor();
if ($fillColorValues !== null && is_array($fillColorValues)) {
foreach ($plotSeriesValues->getDataValues() as $dataKey => $dataValue) {
$this->writePlotSeriesValuesElement($objWriter, $dataKey, (isset($fillColorValues[$dataKey]) ? $fillColorValues[$dataKey] : 'FF9900'));
$this->writePlotSeriesValuesElement($objWriter, $dataKey, ($fillColorValues[$dataKey] ?? 'FF9900'));
}
} else {
$this->writePlotSeriesValuesElement($objWriter);

View File

@ -175,7 +175,7 @@ class Comments extends WriterPart
private function writeVMLComment(XMLWriter $objWriter, $pCellReference, Comment $pComment)
{
// Metadata
list($column, $row) = Coordinate::coordinateFromString($pCellReference);
[$column, $row] = Coordinate::coordinateFromString($pCellReference);
$column = Coordinate::columnIndexFromString($column);
$id = 1024 + $column + $row;
$id = substr($id, 0, 4);

View File

@ -339,7 +339,7 @@ class Workbook extends WriterPart
$range = Coordinate::splitRange($autoFilterRange);
$range = $range[0];
// Strip any worksheet ref so we can make the cell ref absolute
list($ws, $range[0]) = Worksheet::extractSheetTitle($range[0], true);
[$ws, $range[0]] = Worksheet::extractSheetTitle($range[0], true);
$range[0] = Coordinate::absoluteCoordinate($range[0]);
$range[1] = Coordinate::absoluteCoordinate($range[1]);

View File

@ -251,7 +251,7 @@ class Worksheet extends WriterPart
// Pane
$pane = '';
if ($pSheet->getFreezePane()) {
list($xSplit, $ySplit) = Coordinate::coordinateFromString($pSheet->getFreezePane());
[$xSplit, $ySplit] = Coordinate::coordinateFromString($pSheet->getFreezePane());
$xSplit = Coordinate::columnIndexFromString($xSplit);
--$xSplit;
--$ySplit;
@ -752,7 +752,7 @@ class Worksheet extends WriterPart
$range = Coordinate::splitRange($autoFilterRange);
$range = $range[0];
// Strip any worksheet ref
list($ws, $range[0]) = PhpspreadsheetWorksheet::extractSheetTitle($range[0], true);
[$ws, $range[0]] = PhpspreadsheetWorksheet::extractSheetTitle($range[0], true);
$range = implode(':', $range);
$objWriter->writeAttribute('ref', str_replace('$', '', $range));