depreciation updates

This commit is contained in:
Dennis Eichhorn 2022-09-30 00:34:40 +02:00
parent 8caf616b7d
commit 7555fe814f
6 changed files with 23 additions and 21 deletions

View File

@ -3858,8 +3858,10 @@ class Calculation
} }
} }
$tIndex = \is_float($token) ? (int) $token : $token;
// if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack // if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack
if (isset(self::$binaryOperators[$token])) { if (isset(self::$binaryOperators[$tIndex])) {
// We must have two operands, error if we don't // We must have two operands, error if we don't
if (($operand2Data = $stack->pop()) === null) { if (($operand2Data = $stack->pop()) === null) {
return $this->raiseFormulaError('Internal error - Operand value missing from stack'); return $this->raiseFormulaError('Internal error - Operand value missing from stack');

View File

@ -521,12 +521,12 @@ class OLE
$res = ''; $res = '';
for ($i = 0; $i < 4; ++$i) { for ($i = 0; $i < 4; ++$i) {
$hex = $low_part % 0x100; $hex = (int) (((int) $low_part) % 0x100);
$res .= pack('c', $hex); $res .= pack('c', $hex);
$low_part /= 0x100; $low_part /= 0x100;
} }
for ($i = 0; $i < 4; ++$i) { for ($i = 0; $i < 4; ++$i) {
$hex = $high_part % 0x100; $hex = (int) (((int) $high_part) % 0x100);
$res .= pack('c', $hex); $res .= pack('c', $hex);
$high_part /= 0x100; $high_part /= 0x100;
} }

View File

@ -42,7 +42,7 @@ class Iterator implements \Iterator
/** /**
* Rewind iterator. * Rewind iterator.
*/ */
public function rewind() public function rewind() : void
{ {
$this->position = 0; $this->position = 0;
} }
@ -52,7 +52,7 @@ class Iterator implements \Iterator
* *
* @return Worksheet * @return Worksheet
*/ */
public function current() public function current() : mixed
{ {
return $this->subject->getSheet($this->position); return $this->subject->getSheet($this->position);
} }
@ -62,7 +62,7 @@ class Iterator implements \Iterator
* *
* @return int * @return int
*/ */
public function key() public function key() : mixed
{ {
return $this->position; return $this->position;
} }
@ -70,7 +70,7 @@ class Iterator implements \Iterator
/** /**
* Next value. * Next value.
*/ */
public function next() public function next() : void
{ {
++$this->position; ++$this->position;
} }
@ -80,7 +80,7 @@ class Iterator implements \Iterator
* *
* @return bool * @return bool
*/ */
public function valid() public function valid() : bool
{ {
return $this->position < $this->subject->getSheetCount() && $this->position >= 0; return $this->position < $this->subject->getSheetCount() && $this->position >= 0;
} }

View File

@ -113,7 +113,7 @@ class RowCellIterator extends CellIterator
/** /**
* Rewind the iterator to the starting column. * Rewind the iterator to the starting column.
*/ */
public function rewind() public function rewind() : void
{ {
$this->currentColumnIndex = $this->startColumnIndex; $this->currentColumnIndex = $this->startColumnIndex;
} }
@ -123,7 +123,7 @@ class RowCellIterator extends CellIterator
* *
* @return \PhpOffice\PhpSpreadsheet\Cell\Cell * @return \PhpOffice\PhpSpreadsheet\Cell\Cell
*/ */
public function current() public function current() : mixed
{ {
return $this->worksheet->getCellByColumnAndRow($this->currentColumnIndex, $this->rowIndex); return $this->worksheet->getCellByColumnAndRow($this->currentColumnIndex, $this->rowIndex);
} }
@ -133,7 +133,7 @@ class RowCellIterator extends CellIterator
* *
* @return string * @return string
*/ */
public function key() public function key() : mixed
{ {
return Coordinate::stringFromColumnIndex($this->currentColumnIndex); return Coordinate::stringFromColumnIndex($this->currentColumnIndex);
} }
@ -141,7 +141,7 @@ class RowCellIterator extends CellIterator
/** /**
* Set the iterator to its next value. * Set the iterator to its next value.
*/ */
public function next() public function next() : void
{ {
do { do {
++$this->currentColumnIndex; ++$this->currentColumnIndex;
@ -153,7 +153,7 @@ class RowCellIterator extends CellIterator
* *
* @throws PhpSpreadsheetException * @throws PhpSpreadsheetException
*/ */
public function prev() public function prev() : void
{ {
do { do {
--$this->currentColumnIndex; --$this->currentColumnIndex;
@ -165,7 +165,7 @@ class RowCellIterator extends CellIterator
* *
* @return bool * @return bool
*/ */
public function valid() public function valid() : bool
{ {
return $this->currentColumnIndex <= $this->endColumnIndex && $this->currentColumnIndex >= $this->startColumnIndex; return $this->currentColumnIndex <= $this->endColumnIndex && $this->currentColumnIndex >= $this->startColumnIndex;
} }

View File

@ -117,7 +117,7 @@ class RowIterator implements \Iterator
/** /**
* Rewind the iterator to the starting row. * Rewind the iterator to the starting row.
*/ */
public function rewind() public function rewind() : void
{ {
$this->position = $this->startRow; $this->position = $this->startRow;
} }
@ -127,7 +127,7 @@ class RowIterator implements \Iterator
* *
* @return Row * @return Row
*/ */
public function current() public function current() : mixed
{ {
return new Row($this->subject, $this->position); return new Row($this->subject, $this->position);
} }
@ -137,7 +137,7 @@ class RowIterator implements \Iterator
* *
* @return int * @return int
*/ */
public function key() public function key() : mixed
{ {
return $this->position; return $this->position;
} }
@ -145,7 +145,7 @@ class RowIterator implements \Iterator
/** /**
* Set the iterator to its next value. * Set the iterator to its next value.
*/ */
public function next() public function next() : void
{ {
++$this->position; ++$this->position;
} }
@ -153,7 +153,7 @@ class RowIterator implements \Iterator
/** /**
* Set the iterator to its previous value. * Set the iterator to its previous value.
*/ */
public function prev() public function prev() : void
{ {
--$this->position; --$this->position;
} }
@ -163,7 +163,7 @@ class RowIterator implements \Iterator
* *
* @return bool * @return bool
*/ */
public function valid() public function valid() : bool
{ {
return $this->position <= $this->endRow && $this->position >= $this->startRow; return $this->position <= $this->endRow && $this->position >= $this->startRow;
} }

View File

@ -42,7 +42,7 @@ class StringTable extends WriterPart
if (!is_object($cellValue) && if (!is_object($cellValue) &&
($cellValue !== null) && ($cellValue !== null) &&
$cellValue !== '' && $cellValue !== '' &&
!isset($aFlippedStringTable[$cellValue]) && !isset($aFlippedStringTable[\is_float($cellValue) ? (int) $cellValue : $cellValue]) &&
($cell->getDataType() == DataType::TYPE_STRING || $cell->getDataType() == DataType::TYPE_STRING2 || $cell->getDataType() == DataType::TYPE_NULL)) { ($cell->getDataType() == DataType::TYPE_STRING || $cell->getDataType() == DataType::TYPE_STRING2 || $cell->getDataType() == DataType::TYPE_NULL)) {
$aStringTable[] = $cellValue; $aStringTable[] = $cellValue;
$aFlippedStringTable[$cellValue] = true; $aFlippedStringTable[$cellValue] = true;