Merge pull request #82 from box/fix_double_equals

Replace == with ===
This commit is contained in:
Adrien Loison 2015-08-10 19:21:18 -07:00
commit 2a1925bc51
3 changed files with 7 additions and 7 deletions

View File

@ -71,7 +71,7 @@ class CellHelper
{ {
$currentColumnIndex = ord($single_cell_index) - $capitalAAsciiValue; $currentColumnIndex = ord($single_cell_index) - $capitalAAsciiValue;
if ($columnLength == 1) { if ($columnLength === 1) {
$columnIndex += $currentColumnIndex; $columnIndex += $currentColumnIndex;
} else { } else {
$columnIndex += pow($step, ($columnLength - 1)) * ($currentColumnIndex + 1); $columnIndex += pow($step, ($columnLength - 1)) * ($currentColumnIndex + 1);

View File

@ -142,7 +142,7 @@ class RowIterator implements IteratorInterface
try { try {
while ($this->xmlReader->read()) { while ($this->xmlReader->read()) {
if ($this->xmlReader->nodeType == XMLReader::ELEMENT && $this->xmlReader->name === self::XML_NODE_DIMENSION) { if ($this->xmlReader->nodeType === XMLReader::ELEMENT && $this->xmlReader->name === self::XML_NODE_DIMENSION) {
// Read dimensions of the sheet // Read dimensions of the sheet
$dimensionRef = $this->xmlReader->getAttribute(self::XML_ATTRIBUTE_REF); // returns 'A1:M13' for instance (or 'A1' for empty sheet) $dimensionRef = $this->xmlReader->getAttribute(self::XML_ATTRIBUTE_REF); // returns 'A1:M13' for instance (or 'A1' for empty sheet)
if (preg_match('/[A-Z\d]+:([A-Z\d]+)/', $dimensionRef, $matches)) { if (preg_match('/[A-Z\d]+:([A-Z\d]+)/', $dimensionRef, $matches)) {
@ -150,7 +150,7 @@ class RowIterator implements IteratorInterface
$this->numColumns = CellHelper::getColumnIndexFromCellIndex($lastCellIndex) + 1; $this->numColumns = CellHelper::getColumnIndexFromCellIndex($lastCellIndex) + 1;
} }
} else if ($this->xmlReader->nodeType == XMLReader::ELEMENT && $this->xmlReader->name === self::XML_NODE_ROW) { } else if ($this->xmlReader->nodeType === XMLReader::ELEMENT && $this->xmlReader->name === self::XML_NODE_ROW) {
// Start of the row description // Start of the row description
$isInsideRowTag = true; $isInsideRowTag = true;
@ -163,7 +163,7 @@ class RowIterator implements IteratorInterface
} }
$rowData = ($numberOfColumnsForRow !== 0) ? array_fill(0, $numberOfColumnsForRow, '') : []; $rowData = ($numberOfColumnsForRow !== 0) ? array_fill(0, $numberOfColumnsForRow, '') : [];
} else if ($isInsideRowTag && $this->xmlReader->nodeType == XMLReader::ELEMENT && $this->xmlReader->name === self::XML_NODE_CELL) { } else if ($isInsideRowTag && $this->xmlReader->nodeType === XMLReader::ELEMENT && $this->xmlReader->name === self::XML_NODE_CELL) {
// Start of a cell description // Start of a cell description
$currentCellIndex = $this->xmlReader->getAttribute(self::XML_ATTRIBUTE_CELL_INDEX); $currentCellIndex = $this->xmlReader->getAttribute(self::XML_ATTRIBUTE_CELL_INDEX);
$currentColumnIndex = CellHelper::getColumnIndexFromCellIndex($currentCellIndex); $currentColumnIndex = CellHelper::getColumnIndexFromCellIndex($currentCellIndex);
@ -171,14 +171,14 @@ class RowIterator implements IteratorInterface
$node = $this->xmlReader->expand(); $node = $this->xmlReader->expand();
$rowData[$currentColumnIndex] = $this->getCellValue($node); $rowData[$currentColumnIndex] = $this->getCellValue($node);
} else if ($this->xmlReader->nodeType == XMLReader::END_ELEMENT && $this->xmlReader->name === self::XML_NODE_ROW) { } else if ($this->xmlReader->nodeType === XMLReader::END_ELEMENT && $this->xmlReader->name === self::XML_NODE_ROW) {
// End of the row description // End of the row description
// If needed, we fill the empty cells // If needed, we fill the empty cells
$rowData = ($this->numColumns !== 0) ? $rowData : CellHelper::fillMissingArrayIndexes($rowData); $rowData = ($this->numColumns !== 0) ? $rowData : CellHelper::fillMissingArrayIndexes($rowData);
$this->numReadRows++; $this->numReadRows++;
break; break;
} else if ($this->xmlReader->nodeType == XMLReader::END_ELEMENT && $this->xmlReader->name === self::XML_NODE_WORKSHEET) { } else if ($this->xmlReader->nodeType === XMLReader::END_ELEMENT && $this->xmlReader->name === self::XML_NODE_WORKSHEET) {
// The closing "</worksheet>" marks the end of the file // The closing "</worksheet>" marks the end of the file
$this->hasReachedEndOfFile = true; $this->hasReachedEndOfFile = true;
} }

View File

@ -160,7 +160,7 @@ class Workbook
$worksheetFound = null; $worksheetFound = null;
foreach ($this->worksheets as $worksheet) { foreach ($this->worksheets as $worksheet) {
if ($worksheet->getExternalSheet() == $sheet) { if ($worksheet->getExternalSheet() === $sheet) {
$worksheetFound = $worksheet; $worksheetFound = $worksheet;
break; break;
} }