Phpstan Level 9 - Part 1 of Many

Dealing mostly with mixed variable type. In a great many cases, problems can be resolved replacing `getValue` with `getValueString` or `getCalculatedValue` with `getCalculatedValueString`.
This commit is contained in:
oleibman
2025-03-05 21:59:54 -08:00
parent 875dc354f9
commit d1d12ed92d
78 changed files with 2208 additions and 199 deletions
@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace PhpOffice\PhpSpreadsheetTests\Shared;
use DateTime;
use PhpOffice\PhpSpreadsheet\Exception as SpreadsheetException;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Csv;
@@ -120,4 +122,13 @@ class StringHelperTest extends TestCase
$spreadsheet->disconnectWorksheets();
self::assertSame('"1.4";"1004.5";"1000000.5"' . PHP_EOL, $output);
}
public function testNonStringable(): void
{
$dt = new DateTime();
self::assertSame('', StringHelper::convertToString($dt, false));
$this->expectException(SpreadsheetException::class);
$this->expectExceptionMessage('Unable to convert to string');
StringHelper::convertToString($dt);
}
}