mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-24 01:00:05 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user