diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..df30947 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +.idea/ diff --git a/src/Exporters/Sheet.php b/src/Exporters/Sheet.php index 323cdbf..455a843 100644 --- a/src/Exporters/Sheet.php +++ b/src/Exporters/Sheet.php @@ -120,7 +120,7 @@ public function getHeadingStyle() * @param string $name * @return $this */ - public function name($name) + public function name(?string $name) { if (is_string($name)) { $this->name = $name; diff --git a/tests/Exporters/XLSX/WithChunkQueryTest.php b/tests/Exporters/XLSX/WithChunkQueryTest.php index e578dd6..7a58c7e 100644 --- a/tests/Exporters/XLSX/WithChunkQueryTest.php +++ b/tests/Exporters/XLSX/WithChunkQueryTest.php @@ -32,7 +32,7 @@ public function testStore() ->store($storePath); // 读取 - $this->assertSingleSheet($storePath, 'Sheet1', $users); + $this->assertSingleSheet($storePath, '0', $users); /* |--------------------------------------------------------------- @@ -81,7 +81,7 @@ public function testRaw() file_put_contents($storePath, $contents); // 读取 - $this->assertSingleSheet($storePath, 'Sheet1', $users); + $this->assertSingleSheet($storePath, '0', $users); /* |--------------------------------------------------------------- diff --git a/tests/Exporters/XLSX/WithSheetTest.php b/tests/Exporters/XLSX/WithSheetTest.php index c658e28..8ddf7ce 100644 --- a/tests/Exporters/XLSX/WithSheetTest.php +++ b/tests/Exporters/XLSX/WithSheetTest.php @@ -24,6 +24,7 @@ public function test() $storePath = $this->generateTempFilePath('xlsx'); $sheet = Excel::createSheet($users) + ->name('test') ->headingStyle( (new StyleBuilder) ->setFontColor(Color::BLUE) @@ -43,7 +44,7 @@ public function test() Excel::export($sheet)->store($storePath); // 读取 - $this->assertSingleSheet($storePath, 'Sheet1', $users); + $this->assertSingleSheet($storePath, 'test', $users); /* |---------------------------------------------------------------