2 Tests vs. Scrutinizer/Phpstan

Just reviewing Scrutinizer's list of "bugs". There are 19 ascribed to me. For some, I will definitely take no action (e.g. use of bitwise operators in AND, OR, and XOR functions). However, where I can clean things up so that Scrutinizer is satisfied and the resulting code is not too contorted, I will make an attempt.

This PR corrects 2 problems according to Scrutinizer, and 1 per Phpstan. Only test members are involved.
This commit is contained in:
Owen Leibman 2021-06-30 18:56:25 -07:00 committed by Mark Baker
parent 435ac30b47
commit b03544469b
3 changed files with 10 additions and 9 deletions

View File

@ -6800,11 +6800,6 @@ parameters:
count: 3
path: tests/PhpSpreadsheetTests/Writer/Html/HtmlCommentsTest.php
-
message: "#^Parameter \\#1 \\$directory of function chdir expects string, string\\|false given\\.$#"
count: 1
path: tests/PhpSpreadsheetTests/Writer/Html/ImagesRootTest.php
-
message: "#^Parameter \\#1 \\$options of static method PhpOffice\\\\PhpSpreadsheet\\\\Settings\\:\\:setLibXmlLoaderOptions\\(\\) expects int, null given\\.$#"
count: 1

View File

@ -92,7 +92,7 @@ class SubTotalTest extends AllSetupTeardown
'12' => false,
];
foreach ($visibleRows as $row => $visible) {
$rowDimension = $sheet->getRowDimension($row);
$rowDimension = $sheet->getRowDimension((int) $row);
$rowDimension->setVisible($visible);
}
$sheet->getCell('D2')->setValue("=SUBTOTAL($type, A1:$maxCol$maxRow)");

View File

@ -10,13 +10,18 @@ use PhpOffice\PhpSpreadsheetTests\Functional;
class ImagesRootTest extends Functional\AbstractFunctional
{
/**
* @var false|string
* @var string
*/
private $curdir;
private $curdir = '';
protected function setUp(): void
{
$this->curdir = getcwd();
$curdir = getcwd();
if ($curdir === false) {
self::fail('Unable to obtain current directory');
} else {
$this->curdir = $curdir;
}
}
protected function tearDown(): void
@ -64,5 +69,6 @@ class ImagesRootTest extends Functional\AbstractFunctional
self::assertCount(1, $img);
self::assertEquals("$root/$stub", $img[0]->getAttribute('src'));
self::assertEquals($desc, $img[0]->getAttribute('alt'));
$spreadsheet->disconnectWorksheets();
}
}