More fixes from PhpStorm warnings

This commit is contained in:
Adrien Crivelli 2017-10-08 02:00:30 +09:00
parent 1259549466
commit 483f3c98ff
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
16 changed files with 54 additions and 63 deletions

View File

@ -2037,14 +2037,6 @@ class Calculation
return self::$instance;
}
/**
* Unset an instance of this class.
*/
public function __destruct()
{
$this->workbook = null;
}
/**
* Flush the calculation cache for any existing instance of this class
* but only if a Calculation instance exists.

View File

@ -19,7 +19,7 @@ class Financial
*
* @return bool
*/
private static function isLastDayOfMonth($testDate)
private static function isLastDayOfMonth(\DateTime $testDate)
{
return $testDate->format('d') == $testDate->format('t');
}

View File

@ -300,7 +300,7 @@ class Statistical
$y = $x;
if ($y > 0.0 && $y <= self::LOG_GAMMA_X_MAX_VALUE) {
if ($y <= self::EPS) {
$res = -log(y);
$res = -log($y);
} elseif ($y <= 1.5) {
// ---------------------
// EPS .LT. X .LE. 1.5

View File

@ -581,6 +581,9 @@ class Html
protected $stringData = '';
/**
* @var RichText
*/
protected $richTextObject;
protected function initialise()

View File

@ -7,9 +7,9 @@ class DefaultReadFilter implements IReadFilter
/**
* Should this cell be read?
*
* @param $column Column address (as a string value like "A", or "IV")
* @param $row Row number
* @param $worksheetName Optional worksheet name
* @param string $column Column address (as a string value like "A", or "IV")
* @param int $row Row number
* @param string $worksheetName Optional worksheet name
*
* @return bool
*/

View File

@ -238,7 +238,7 @@ class Html extends BaseReader implements IReader
return array_pop($this->nestedColumn);
}
protected function flushCell($sheet, $column, $row, &$cellContent)
protected function flushCell(Worksheet $sheet, $column, $row, &$cellContent)
{
if (is_string($cellContent)) {
// Simple String content

View File

@ -485,7 +485,7 @@ class Slk extends BaseReader implements IReader
*
* @param int $pValue Sheet index
*
* @return SYLK
* @return Slk
*/
public function setSheetIndex($pValue)
{

View File

@ -23,7 +23,6 @@ use PhpOffice\PhpSpreadsheet\Style\Font;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Style\Protection;
use PhpOffice\PhpSpreadsheet\Worksheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
use PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing;
use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup;
use PhpOffice\PhpSpreadsheet\Worksheet\SheetView;

View File

@ -83,7 +83,7 @@ class EigenvalueDecomposition
$i_ = $i - 1;
// Scale to avoid under/overflow.
$h = $scale = 0.0;
$scale += array_sum(array_map(abs, $this->d));
$scale += array_sum(array_map('abs', $this->d));
if ($scale == 0.0) {
$this->e[$i] = $this->d[$i_];
$this->d = array_slice($this->V[$i_], 0, $i_);

View File

@ -541,7 +541,7 @@ class OLE
public static function OLE2LocalDate($string)
{
if (strlen($string) != 8) {
return new PEAR_Error('Expecting 8 byte string');
throw new ReaderException('Expecting 8 byte string');
}
// factor used for separating numbers into 4 bytes parts

View File

@ -47,7 +47,7 @@ class Root extends PPS
*/
public function __construct($time_1st, $time_2nd, $raChild)
{
$this->_tempDir = \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir();
$this->tempDirectory = \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir();
parent::__construct(null, OLE::ascToUcs('Root Entry'), OLE::OLE_PPS_TYPE_ROOT, null, null, null, $time_1st, $time_2nd, null, $raChild);
}

View File

@ -61,10 +61,10 @@ class ExponentialBestFit extends BestFit
public function getSlope($dp = 0)
{
if ($dp != 0) {
return round(exp($this->_slope), $dp);
return round(exp($this->slope), $dp);
}
return exp($this->_slope);
return exp($this->slope);
}
/**

View File

@ -101,14 +101,14 @@ class PolynomialBestFit extends BestFit
{
if ($dp != 0) {
$coefficients = [];
foreach ($this->_slope as $coefficient) {
foreach ($this->slope as $coefficient) {
$coefficients[] = round($coefficient, $dp);
}
return $coefficients;
}
return $this->_slope;
return $this->slope;
}
public function getCoefficients($dp = 0)
@ -164,7 +164,7 @@ class PolynomialBestFit extends BestFit
}
$this->intersect = array_shift($coefficients);
$this->_slope = $coefficients;
$this->slope = $coefficients;
$this->calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum);
foreach ($this->xValues as $xKey => $xValue) {
@ -188,10 +188,10 @@ class PolynomialBestFit extends BestFit
$this->order = $order;
$this->polynomialRegression($order, $yValues, $xValues);
if (($this->getGoodnessOfFit() < 0.0) || ($this->getGoodnessOfFit() > 1.0)) {
$this->_error = true;
$this->error = true;
}
} else {
$this->_error = true;
$this->error = true;
}
}
}

View File

@ -6,6 +6,7 @@ use PhpOffice\PhpSpreadsheet\Cell;
use PhpOffice\PhpSpreadsheet\RichText;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
use PhpOffice\PhpSpreadsheet\Worksheet;
use PhpOffice\PhpSpreadsheet\Writer\Exception as WriterException;
class StringTable extends WriterPart
@ -20,9 +21,8 @@ class StringTable extends WriterPart
*
* @return string[] String table for worksheet
*/
public function createStringTable($pSheet = null, $pExistingTable = null)
public function createStringTable(Worksheet $pSheet, $pExistingTable = null)
{
if ($pSheet !== null) {
// Create string lookup table
$aStringTable = [];
$cellCollection = null;
@ -58,9 +58,6 @@ class StringTable extends WriterPart
return $aStringTable;
}
throw new WriterException('Invalid Worksheet object passed.');
}
/**
* Write string table to XML format.
*

View File

@ -10,7 +10,7 @@ use PHPUnit_Framework_TestCase;
class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
{
public $mockWorksheet;
public $mockColumnCell;
public $mockCell;
public function setUp()
{

View File

@ -10,7 +10,7 @@ use PHPUnit_Framework_TestCase;
class RowCellIteratorTest extends PHPUnit_Framework_TestCase
{
public $mockWorksheet;
public $mockRowCell;
public $mockCell;
public function setUp()
{