diff --git a/.php_cs b/.php_cs index 0727b5ca..ee2d4138 100644 --- a/.php_cs +++ b/.php_cs @@ -13,16 +13,16 @@ declare(strict_types=1); use Ergebnis\PhpCsFixer\Config; -$header = Config\Header\Header::create( - Config\Header\CopyrightYears::fromYear(Config\Header\Year::fromString('2019')), - Config\Header\Author::fromString('Andreas Möller'), - Config\Header\License::fromString( +$header = Config\License\Header::create( + Config\License\CopyrightYears::fromYear(Config\License\Year::fromString('2019')), + Config\License\Author::fromString('Andreas Möller'), + Config\License\Notice::fromString( <<<'EOF' For the full copyright and license information, please view the LICENSE file that was distributed with this source code. EOF ), - Config\Header\Url::fromString('https://github.com/ergebnis/php-cs-fixer-config') + Config\License\Url::fromString('https://github.com/ergebnis/php-cs-fixer-config') ); $config = Config\Factory::fromRuleSet(new Config\RuleSet\Php71($header->toString())); diff --git a/src/Header/Author.php b/src/License/Author.php similarity index 95% rename from src/Header/Author.php rename to src/License/Author.php index a52802a0..4003d76d 100644 --- a/src/Header/Author.php +++ b/src/License/Author.php @@ -11,7 +11,7 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Header; +namespace Ergebnis\PhpCsFixer\Config\License; /** * @internal diff --git a/src/Header/CopyrightYears.php b/src/License/CopyrightYears.php similarity index 96% rename from src/Header/CopyrightYears.php rename to src/License/CopyrightYears.php index 009bab86..ba47abbb 100644 --- a/src/Header/CopyrightYears.php +++ b/src/License/CopyrightYears.php @@ -11,7 +11,7 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Header; +namespace Ergebnis\PhpCsFixer\Config\License; /** * @internal diff --git a/src/Header/Header.php b/src/License/Header.php similarity index 78% rename from src/Header/Header.php rename to src/License/Header.php index c7a9e2b4..0a7f9af0 100644 --- a/src/Header/Header.php +++ b/src/License/Header.php @@ -11,7 +11,7 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Header; +namespace Ergebnis\PhpCsFixer\Config\License; /** * @internal @@ -22,31 +22,31 @@ final class Header private $author; - private $license; + private $notice; private $url; - private function __construct(CopyrightYears $copyrightYear, Author $author, License $license, Url $url) + private function __construct(CopyrightYears $copyrightYear, Author $author, Notice $notice, Url $url) { $this->copyrightYear = $copyrightYear; $this->author = $author; - $this->license = $license; + $this->notice = $notice; $this->url = $url; } - public static function create(CopyrightYears $copyrightYear, Author $author, License $license, Url $url): self + public static function create(CopyrightYears $copyrightYear, Author $author, Notice $notice, Url $url): self { return new self( $copyrightYear, $author, - $license, + $notice, $url ); } public function toString(): string { - if ($this->license->isEmpty()) { + if ($this->notice->isEmpty()) { return <<copyrightYear->toString()} {$this->author->toString()} @@ -57,7 +57,7 @@ public function toString(): string return <<copyrightYear->toString()} {$this->author->toString()} -{$this->license->toString()} +{$this->notice->toString()} @see {$this->url->toString()} EOF; diff --git a/src/Header/License.php b/src/License/Notice.php similarity index 91% rename from src/Header/License.php rename to src/License/Notice.php index 5363ca14..7757b627 100644 --- a/src/Header/License.php +++ b/src/License/Notice.php @@ -11,12 +11,12 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Header; +namespace Ergebnis\PhpCsFixer\Config\License; /** * @internal */ -final class License +final class Notice { private $value; diff --git a/src/Header/Url.php b/src/License/Url.php similarity index 95% rename from src/Header/Url.php rename to src/License/Url.php index ecd61eee..12334674 100644 --- a/src/Header/Url.php +++ b/src/License/Url.php @@ -11,7 +11,7 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Header; +namespace Ergebnis\PhpCsFixer\Config\License; /** * @internal diff --git a/src/Header/Year.php b/src/License/Year.php similarity index 96% rename from src/Header/Year.php rename to src/License/Year.php index 588f2723..f268f62d 100644 --- a/src/Header/Year.php +++ b/src/License/Year.php @@ -11,7 +11,7 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Header; +namespace Ergebnis\PhpCsFixer\Config\License; /** * @internal diff --git a/test/Unit/Header/AuthorTest.php b/test/Unit/License/AuthorTest.php similarity index 93% rename from test/Unit/Header/AuthorTest.php rename to test/Unit/License/AuthorTest.php index 8e13de27..b9d216c2 100644 --- a/test/Unit/Header/AuthorTest.php +++ b/test/Unit/License/AuthorTest.php @@ -11,16 +11,16 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Test\Unit\Header; +namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License; -use Ergebnis\PhpCsFixer\Config\Header\Author; +use Ergebnis\PhpCsFixer\Config\License\Author; use Ergebnis\Test\Util\Helper; use PHPUnit\Framework; /** * @internal * - * @covers \Ergebnis\PhpCsFixer\Config\Header\Author + * @covers \Ergebnis\PhpCsFixer\Config\License\Author */ final class AuthorTest extends Framework\TestCase { diff --git a/test/Unit/Header/CopyrightYearsTest.php b/test/Unit/License/CopyrightYearsTest.php similarity index 85% rename from test/Unit/Header/CopyrightYearsTest.php rename to test/Unit/License/CopyrightYearsTest.php index 0ac997b4..47f4ea84 100644 --- a/test/Unit/Header/CopyrightYearsTest.php +++ b/test/Unit/License/CopyrightYearsTest.php @@ -11,21 +11,21 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Test\Unit\Header; +namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License; -use Ergebnis\PhpCsFixer\Config\Header\CopyrightYears; -use Ergebnis\PhpCsFixer\Config\Header\Year; +use Ergebnis\PhpCsFixer\Config\License\CopyrightYears; +use Ergebnis\PhpCsFixer\Config\License\Year; use Ergebnis\Test\Util\Helper; use PHPUnit\Framework; /** * @internal * - * @covers \Ergebnis\PhpCsFixer\Config\Header\CopyrightYears + * @covers \Ergebnis\PhpCsFixer\Config\License\CopyrightYears * - * @uses \Ergebnis\PhpCsFixer\Config\Header\Author - * @uses \Ergebnis\PhpCsFixer\Config\Header\Url - * @uses \Ergebnis\PhpCsFixer\Config\Header\Year + * @uses \Ergebnis\PhpCsFixer\Config\License\Author + * @uses \Ergebnis\PhpCsFixer\Config\License\Url + * @uses \Ergebnis\PhpCsFixer\Config\License\Year */ final class CopyrightYearsTest extends Framework\TestCase { diff --git a/test/Unit/Header/HeaderTest.php b/test/Unit/License/HeaderTest.php similarity index 71% rename from test/Unit/Header/HeaderTest.php rename to test/Unit/License/HeaderTest.php index 7ac58e78..838f28b9 100644 --- a/test/Unit/Header/HeaderTest.php +++ b/test/Unit/License/HeaderTest.php @@ -11,27 +11,27 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Test\Unit\Header; - -use Ergebnis\PhpCsFixer\Config\Header\Author; -use Ergebnis\PhpCsFixer\Config\Header\CopyrightYears; -use Ergebnis\PhpCsFixer\Config\Header\Header; -use Ergebnis\PhpCsFixer\Config\Header\License; -use Ergebnis\PhpCsFixer\Config\Header\Url; -use Ergebnis\PhpCsFixer\Config\Header\Year; +namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License; + +use Ergebnis\PhpCsFixer\Config\License\Author; +use Ergebnis\PhpCsFixer\Config\License\CopyrightYears; +use Ergebnis\PhpCsFixer\Config\License\Header; +use Ergebnis\PhpCsFixer\Config\License\Notice; +use Ergebnis\PhpCsFixer\Config\License\Url; +use Ergebnis\PhpCsFixer\Config\License\Year; use Ergebnis\Test\Util\Helper; use PHPUnit\Framework; /** * @internal * - * @covers \Ergebnis\PhpCsFixer\Config\Header\Header + * @covers \Ergebnis\PhpCsFixer\Config\License\Header * - * @uses \Ergebnis\PhpCsFixer\Config\Header\Author - * @uses \Ergebnis\PhpCsFixer\Config\Header\CopyrightYears - * @uses \Ergebnis\PhpCsFixer\Config\Header\License - * @uses \Ergebnis\PhpCsFixer\Config\Header\Url - * @uses \Ergebnis\PhpCsFixer\Config\Header\Year + * @uses \Ergebnis\PhpCsFixer\Config\License\Author + * @uses \Ergebnis\PhpCsFixer\Config\License\CopyrightYears + * @uses \Ergebnis\PhpCsFixer\Config\License\Notice + * @uses \Ergebnis\PhpCsFixer\Config\License\Url + * @uses \Ergebnis\PhpCsFixer\Config\License\Year */ final class HeaderTest extends Framework\TestCase { @@ -53,7 +53,7 @@ public function testCreateReturnsHeaderWhenLicenseIsEmpty(): void $header = Header::create( $copyrightYears, $author, - License::fromString(''), + Notice::fromString(''), $url ); @@ -77,7 +77,7 @@ public function testCreateReturnsHeaderWhenLicenseIsNotEmpty(): void $author = Author::fromString($faker->name); - $license = License::fromString( + $notice = Notice::fromString( <<<'EOF' For the full copyright and license information, please view the LICENSE file that was distributed with this source code. @@ -89,14 +89,14 @@ public function testCreateReturnsHeaderWhenLicenseIsNotEmpty(): void $header = Header::create( $copyrightYears, $author, - $license, + $notice, $url ); $expected = <<toString()} {$author->toString()} -{$license->toString()} +{$notice->toString()} @see {$url->toString()} EOF; diff --git a/test/Unit/Header/LicenseTest.php b/test/Unit/License/NoticeTest.php similarity index 70% rename from test/Unit/Header/LicenseTest.php rename to test/Unit/License/NoticeTest.php index 5ec6df79..b64337c2 100644 --- a/test/Unit/Header/LicenseTest.php +++ b/test/Unit/License/NoticeTest.php @@ -11,18 +11,18 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Test\Unit\Header; +namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License; -use Ergebnis\PhpCsFixer\Config\Header\License; +use Ergebnis\PhpCsFixer\Config\License\Notice; use Ergebnis\Test\Util\Helper; use PHPUnit\Framework; /** * @internal * - * @covers \Ergebnis\PhpCsFixer\Config\Header\License + * @covers \Ergebnis\PhpCsFixer\Config\License\Notice */ -final class LicenseTest extends Framework\TestCase +final class NoticeTest extends Framework\TestCase { use Helper; @@ -31,11 +31,11 @@ final class LicenseTest extends Framework\TestCase * * @param string $value */ - public function testFromStringReturnsLicense(string $value): void + public function testFromStringReturnsNotice(string $value): void { - $license = License::fromString($value); + $notice = Notice::fromString($value); - self::assertSame($value, $license->toString()); + self::assertSame($value, $notice->toString()); } public function provideValidValue(): \Generator @@ -52,11 +52,11 @@ public function provideValidValue(): \Generator * * @param string $value */ - public function testFromStringReturnsLicenseWithTrimmedValue(string $value): void + public function testFromStringReturnsNoticeWithTrimmedValue(string $value): void { - $license = License::fromString($value); + $notice = Notice::fromString($value); - self::assertSame(\trim($value), $license->toString()); + self::assertSame(\trim($value), $notice->toString()); } public function provideUntrimmedValue(): \Generator @@ -73,9 +73,9 @@ public function provideUntrimmedValue(): \Generator public function testIsEmptyReturnsFalseWhenTrimmedValueIsNotEmpty(): void { - $license = License::fromString(self::faker()->realText()); + $notice = Notice::fromString(self::faker()->realText()); - self::assertFalse($license->isEmpty()); + self::assertFalse($notice->isEmpty()); } /** @@ -85,9 +85,9 @@ public function testIsEmptyReturnsFalseWhenTrimmedValueIsNotEmpty(): void */ public function testIsEmptyReturnsTrueWhenTrimmedValueIsEmpty(string $value): void { - $license = License::fromString($value); + $notice = Notice::fromString($value); - self::assertTrue($license->isEmpty()); + self::assertTrue($notice->isEmpty()); } public function provideBlankOrEmptyString(): \Generator diff --git a/test/Unit/Header/UrlTest.php b/test/Unit/License/UrlTest.php similarity index 94% rename from test/Unit/Header/UrlTest.php rename to test/Unit/License/UrlTest.php index 8404c294..3b9eb11e 100644 --- a/test/Unit/Header/UrlTest.php +++ b/test/Unit/License/UrlTest.php @@ -11,16 +11,16 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Test\Unit\Header; +namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License; -use Ergebnis\PhpCsFixer\Config\Header\Url; +use Ergebnis\PhpCsFixer\Config\License\Url; use Ergebnis\Test\Util\Helper; use PHPUnit\Framework; /** * @internal * - * @covers \Ergebnis\PhpCsFixer\Config\Header\Url + * @covers \Ergebnis\PhpCsFixer\Config\License\Url */ final class UrlTest extends Framework\TestCase { diff --git a/test/Unit/Header/YearTest.php b/test/Unit/License/YearTest.php similarity index 95% rename from test/Unit/Header/YearTest.php rename to test/Unit/License/YearTest.php index 511a454b..30e07b9f 100644 --- a/test/Unit/Header/YearTest.php +++ b/test/Unit/License/YearTest.php @@ -11,16 +11,16 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Test\Unit\Header; +namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License; -use Ergebnis\PhpCsFixer\Config\Header\Year; +use Ergebnis\PhpCsFixer\Config\License\Year; use Ergebnis\Test\Util\Helper; use PHPUnit\Framework; /** * @internal * - * @covers \Ergebnis\PhpCsFixer\Config\Header\Year + * @covers \Ergebnis\PhpCsFixer\Config\License\Year */ final class YearTest extends Framework\TestCase {