diff --git a/src/Config.php b/src/Config.php index c8c5156..abfa0c8 100644 --- a/src/Config.php +++ b/src/Config.php @@ -325,6 +325,9 @@ public function setDefaultHeaderComment( string $packageName, array | string $copyright = [] ) : static { + if ($copyright === '') { + $copyright = []; + } $copyright = (array) $copyright; $copyrightLines = "\n"; if ($copyright) { diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index 3581644..5b20dab 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -49,6 +49,11 @@ public function testDefaultHeaderComment() : void $header = $this->config->getRules()['header_comment']['header']; self::assertStringContainsString('Foo Bar', $header); self::assertStringNotContainsString('(c)', $header); + $this->config->setDefaultHeaderComment('Foo Bar', ''); + // @phpstan-ignore-next-line + $header = $this->config->getRules()['header_comment']['header']; + self::assertStringContainsString('Foo Bar', $header); + self::assertStringNotContainsString('(c)', $header); $this->config->setDefaultHeaderComment('Bazz', 'Acme'); // @phpstan-ignore-next-line $header = $this->config->getRules()['header_comment']['header'];