File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
tests/PhpSpreadsheetTests/Cell Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 22
33namespace PhpOffice \PhpSpreadsheet \Cell ;
44
5- use DateTime ;
5+ use DateTimeInterface ;
66use PhpOffice \PhpSpreadsheet \RichText \RichText ;
77use PhpOffice \PhpSpreadsheet \Shared \StringHelper ;
88
@@ -16,14 +16,14 @@ class DefaultValueBinder implements IValueBinder
1616 *
1717 * @return bool
1818 */
19- public function bindValue (Cell $ cell , $ value = null )
19+ public function bindValue (Cell $ cell , $ value )
2020 {
2121 // sanitize UTF-8 strings
2222 if (is_string ($ value )) {
2323 $ value = StringHelper::sanitizeUTF8 ($ value );
2424 } elseif (is_object ($ value )) {
2525 // Handle any objects that might be injected
26- if ($ value instanceof DateTime ) {
26+ if ($ value instanceof DateTimeInterface ) {
2727 $ value = $ value ->format ('Y-m-d H:i:s ' );
2828 } elseif (!($ value instanceof RichText)) {
2929 $ value = (string ) $ value ;
Original file line number Diff line number Diff line change @@ -12,5 +12,5 @@ interface IValueBinder
1212 *
1313 * @return bool
1414 */
15- public function bindValue (Cell $ cell , $ value = null );
15+ public function bindValue (Cell $ cell , $ value );
1616}
Original file line number Diff line number Diff line change 33namespace PhpOffice \PhpSpreadsheetTests \Cell ;
44
55use DateTime ;
6+ use DateTimeImmutable ;
67use PhpOffice \PhpSpreadsheet \Cell \Cell ;
78use PhpOffice \PhpSpreadsheet \Cell \DataType ;
89use PhpOffice \PhpSpreadsheet \Cell \DefaultValueBinder ;
1112
1213class DefaultValueBinderTest extends TestCase
1314{
14- protected $ cellStub ;
15+ private $ cellStub ;
1516
16- protected function createCellStub ()
17+ private function createCellStub ()
1718 {
1819 // Create a stub for the Cell class.
1920 $ this ->cellStub = $ this ->getMockBuilder (Cell::class)
@@ -53,6 +54,7 @@ public function binderProvider()
5354 ['-123.456 ' ],
5455 ['#REF! ' ],
5556 [new DateTime ()],
57+ [new DateTimeImmutable ()],
5658 ];
5759 }
5860
You can’t perform that action at this time.
0 commit comments