From 9275e54b508dbf7fb6e30ddeb82b75ad8e29db87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Thu, 2 Jan 2020 19:05:38 +0100 Subject: [PATCH] Fix: Rename --- .php_cs | 4 +-- .../{Author.php => Copyright/Holder.php} | 4 +-- src/License/{ => Copyright}/Year.php | 2 +- .../Years.php} | 4 +-- src/License/Header.php | 20 +++++------ .../HolderTest.php} | 22 ++++++------ .../Unit/License/{ => Copyright}/YearTest.php | 6 ++-- .../YearsTest.php} | 34 +++++++++---------- test/Unit/License/HeaderTest.php | 32 ++++++++--------- test/Unit/License/UrlTest.php | 4 +-- 10 files changed, 66 insertions(+), 66 deletions(-) rename src/License/{Author.php => Copyright/Holder.php} (92%) rename src/License/{ => Copyright}/Year.php (96%) rename src/License/{CopyrightYears.php => Copyright/Years.php} (94%) rename test/Unit/License/{AuthorTest.php => Copyright/HolderTest.php} (76%) rename test/Unit/License/{ => Copyright}/YearTest.php (94%) rename test/Unit/License/{CopyrightYearsTest.php => Copyright/YearsTest.php} (58%) diff --git a/.php_cs b/.php_cs index ee2d4138..32678dcf 100644 --- a/.php_cs +++ b/.php_cs @@ -14,8 +14,8 @@ declare(strict_types=1); use Ergebnis\PhpCsFixer\Config; $header = Config\License\Header::create( - Config\License\CopyrightYears::fromYear(Config\License\Year::fromString('2019')), - Config\License\Author::fromString('Andreas Möller'), + Config\License\Copyright\Years::fromYear(Config\License\Copyright\Year::fromString('2019')), + Config\License\Copyright\Holder::fromString('Andreas Möller'), Config\License\Notice::fromString( <<<'EOF' For the full copyright and license information, please view diff --git a/src/License/Author.php b/src/License/Copyright/Holder.php similarity index 92% rename from src/License/Author.php rename to src/License/Copyright/Holder.php index 4003d76d..b3091da8 100644 --- a/src/License/Author.php +++ b/src/License/Copyright/Holder.php @@ -11,12 +11,12 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\License; +namespace Ergebnis\PhpCsFixer\Config\License\Copyright; /** * @internal */ -final class Author +final class Holder { private $value; diff --git a/src/License/Year.php b/src/License/Copyright/Year.php similarity index 96% rename from src/License/Year.php rename to src/License/Copyright/Year.php index f268f62d..9b4e3478 100644 --- a/src/License/Year.php +++ b/src/License/Copyright/Year.php @@ -11,7 +11,7 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\License; +namespace Ergebnis\PhpCsFixer\Config\License\Copyright; /** * @internal diff --git a/src/License/CopyrightYears.php b/src/License/Copyright/Years.php similarity index 94% rename from src/License/CopyrightYears.php rename to src/License/Copyright/Years.php index ba47abbb..ef552055 100644 --- a/src/License/CopyrightYears.php +++ b/src/License/Copyright/Years.php @@ -11,12 +11,12 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\License; +namespace Ergebnis\PhpCsFixer\Config\License\Copyright; /** * @internal */ -final class CopyrightYears +final class Years { private $value; diff --git a/src/License/Header.php b/src/License/Header.php index 99703be1..079ef2d9 100644 --- a/src/License/Header.php +++ b/src/License/Header.php @@ -18,27 +18,27 @@ */ final class Header { - private $copyrightYears; + private $years; - private $author; + private $holder; private $notice; private $url; - private function __construct(CopyrightYears $copyrightYears, Author $author, Notice $notice, Url $url) + private function __construct(Copyright\Years $years, Copyright\Holder $holder, Notice $notice, Url $url) { - $this->copyrightYears = $copyrightYears; - $this->author = $author; + $this->years = $years; + $this->holder = $holder; $this->notice = $notice; $this->url = $url; } - public static function create(CopyrightYears $copyrightYears, Author $author, Notice $notice, Url $url): self + public static function create(Copyright\Years $years, Copyright\Holder $holder, Notice $notice, Url $url): self { return new self( - $copyrightYears, - $author, + $years, + $holder, $notice, $url ); @@ -48,14 +48,14 @@ public function toString(): string { if ($this->notice->isEmpty()) { return <<copyrightYears->toString()} {$this->author->toString()} +Copyright (c) {$this->years->toString()} {$this->holder->toString()} @see {$this->url->toString()} EOF; } return <<copyrightYears->toString()} {$this->author->toString()} +Copyright (c) {$this->years->toString()} {$this->holder->toString()} {$this->notice->toString()} diff --git a/test/Unit/License/AuthorTest.php b/test/Unit/License/Copyright/HolderTest.php similarity index 76% rename from test/Unit/License/AuthorTest.php rename to test/Unit/License/Copyright/HolderTest.php index b9d216c2..a278d1f9 100644 --- a/test/Unit/License/AuthorTest.php +++ b/test/Unit/License/Copyright/HolderTest.php @@ -11,18 +11,18 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License; +namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License\Copyright; -use Ergebnis\PhpCsFixer\Config\License\Author; +use Ergebnis\PhpCsFixer\Config\License\Copyright\Holder; use Ergebnis\Test\Util\Helper; use PHPUnit\Framework; /** * @internal * - * @covers \Ergebnis\PhpCsFixer\Config\License\Author + * @covers \Ergebnis\PhpCsFixer\Config\License\Copyright\Holder */ -final class AuthorTest extends Framework\TestCase +final class HolderTest extends Framework\TestCase { use Helper; @@ -36,7 +36,7 @@ public function testFromStringRejectsInvalidValue(string $value): void $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Value cannot be blank or empty.'); - Author::fromString($value); + Holder::fromString($value); } public function provideInvalidValue(): \Generator @@ -58,11 +58,11 @@ public function provideInvalidValue(): \Generator * * @param string $value */ - public function testFromStringReturnsAuthor(string $value): void + public function testFromStringReturnsHolder(string $value): void { - $author = Author::fromString($value); + $holder = Holder::fromString($value); - self::assertSame($value, $author->toString()); + self::assertSame($value, $holder->toString()); } public function provideValidValue(): \Generator @@ -79,11 +79,11 @@ public function provideValidValue(): \Generator * * @param string $value */ - public function testFromStringReturnsAuthorWithTrimmedValue(string $value): void + public function testFromStringReturnsHolderWithTrimmedValue(string $value): void { - $author = Author::fromString($value); + $holder = Holder::fromString($value); - self::assertSame(\trim($value), $author->toString()); + self::assertSame(\trim($value), $holder->toString()); } public function provideUntrimmedValue(): \Generator diff --git a/test/Unit/License/YearTest.php b/test/Unit/License/Copyright/YearTest.php similarity index 94% rename from test/Unit/License/YearTest.php rename to test/Unit/License/Copyright/YearTest.php index 30e07b9f..ec5347d5 100644 --- a/test/Unit/License/YearTest.php +++ b/test/Unit/License/Copyright/YearTest.php @@ -11,16 +11,16 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License; +namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License\Copyright; -use Ergebnis\PhpCsFixer\Config\License\Year; +use Ergebnis\PhpCsFixer\Config\License\Copyright\Year; use Ergebnis\Test\Util\Helper; use PHPUnit\Framework; /** * @internal * - * @covers \Ergebnis\PhpCsFixer\Config\License\Year + * @covers \Ergebnis\PhpCsFixer\Config\License\Copyright\Year */ final class YearTest extends Framework\TestCase { diff --git a/test/Unit/License/CopyrightYearsTest.php b/test/Unit/License/Copyright/YearsTest.php similarity index 58% rename from test/Unit/License/CopyrightYearsTest.php rename to test/Unit/License/Copyright/YearsTest.php index 47f4ea84..7d0958f4 100644 --- a/test/Unit/License/CopyrightYearsTest.php +++ b/test/Unit/License/Copyright/YearsTest.php @@ -11,23 +11,23 @@ * @see https://github.com/ergebnis/php-cs-fixer-config */ -namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License; +namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License\Copyright; -use Ergebnis\PhpCsFixer\Config\License\CopyrightYears; -use Ergebnis\PhpCsFixer\Config\License\Year; +use Ergebnis\PhpCsFixer\Config\License\Copyright\Year; +use Ergebnis\PhpCsFixer\Config\License\Copyright\Years; use Ergebnis\Test\Util\Helper; use PHPUnit\Framework; /** * @internal * - * @covers \Ergebnis\PhpCsFixer\Config\License\CopyrightYears + * @covers \Ergebnis\PhpCsFixer\Config\License\Copyright\Years * - * @uses \Ergebnis\PhpCsFixer\Config\License\Author + * @uses \Ergebnis\PhpCsFixer\Config\License\Copyright\Holder + * @uses \Ergebnis\PhpCsFixer\Config\License\Copyright\Year * @uses \Ergebnis\PhpCsFixer\Config\License\Url - * @uses \Ergebnis\PhpCsFixer\Config\License\Year */ -final class CopyrightYearsTest extends Framework\TestCase +final class YearsTest extends Framework\TestCase { use Helper; @@ -43,31 +43,31 @@ public function testFromRangeRequiresStartYearToBeEqualOrLessThanEndYear(): void $endYear->toString() )); - CopyrightYears::fromRange( + Years::fromRange( $startYear, $endYear ); } - public function testFromRangeReturnsCopyrightYearsWhenStartYearEqualsEndYear(): void + public function testFromRangeReturnsYearsWhenStartYearEqualsEndYear(): void { $startYear = Year::fromString('2020'); $endYear = Year::fromString('2020'); - $copyrightYears = CopyrightYears::fromRange( + $years = Years::fromRange( $startYear, $endYear ); - self::assertSame($startYear->toString(), $copyrightYears->toString()); + self::assertSame($startYear->toString(), $years->toString()); } - public function testFromRangeReturnsCopyrightYearsWhenStartYearIsLessThanEndYear(): void + public function testFromRangeReturnsYearsWhenStartYearIsLessThanEndYear(): void { $startYear = Year::fromString('2019'); $endYear = Year::fromString('2020'); - $copyrightYears = CopyrightYears::fromRange( + $years = Years::fromRange( $startYear, $endYear ); @@ -78,15 +78,15 @@ public function testFromRangeReturnsCopyrightYearsWhenStartYearIsLessThanEndYear $endYear->toString() ); - self::assertSame($expected, $copyrightYears->toString()); + self::assertSame($expected, $years->toString()); } - public function testFromYearReturnsCopyrightYears(): void + public function testFromYearReturnsYears(): void { $year = Year::fromString('2019'); - $copyrightYears = CopyrightYears::fromYear($year); + $years = Years::fromYear($year); - self::assertSame($year->toString(), $copyrightYears->toString()); + self::assertSame($year->toString(), $years->toString()); } } diff --git a/test/Unit/License/HeaderTest.php b/test/Unit/License/HeaderTest.php index 838f28b9..e507cff0 100644 --- a/test/Unit/License/HeaderTest.php +++ b/test/Unit/License/HeaderTest.php @@ -13,12 +13,12 @@ namespace Ergebnis\PhpCsFixer\Config\Test\Unit\License; -use Ergebnis\PhpCsFixer\Config\License\Author; -use Ergebnis\PhpCsFixer\Config\License\CopyrightYears; +use Ergebnis\PhpCsFixer\Config\License\Copyright\Holder; +use Ergebnis\PhpCsFixer\Config\License\Copyright\Year; +use Ergebnis\PhpCsFixer\Config\License\Copyright\Years; 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; @@ -27,11 +27,11 @@ * * @covers \Ergebnis\PhpCsFixer\Config\License\Header * - * @uses \Ergebnis\PhpCsFixer\Config\License\Author - * @uses \Ergebnis\PhpCsFixer\Config\License\CopyrightYears + * @uses \Ergebnis\PhpCsFixer\Config\License\Copyright\Holder + * @uses \Ergebnis\PhpCsFixer\Config\License\Copyright\Year + * @uses \Ergebnis\PhpCsFixer\Config\License\Copyright\Years * @uses \Ergebnis\PhpCsFixer\Config\License\Notice * @uses \Ergebnis\PhpCsFixer\Config\License\Url - * @uses \Ergebnis\PhpCsFixer\Config\License\Year */ final class HeaderTest extends Framework\TestCase { @@ -41,24 +41,24 @@ public function testCreateReturnsHeaderWhenLicenseIsEmpty(): void { $faker = self::faker(); - $copyrightYears = CopyrightYears::fromRange( + $years = Years::fromRange( Year::fromString('2019'), Year::fromString(\date('2020')) ); - $author = Author::fromString($faker->name); + $holder = Holder::fromString($faker->name); $url = Url::fromString($faker->url); $header = Header::create( - $copyrightYears, - $author, + $years, + $holder, Notice::fromString(''), $url ); $expected = <<toString()} {$author->toString()} +Copyright (c) {$years->toString()} {$holder->toString()} @see {$url->toString()} EOF; @@ -70,12 +70,12 @@ public function testCreateReturnsHeaderWhenLicenseIsNotEmpty(): void { $faker = self::faker(); - $copyrightYears = CopyrightYears::fromRange( + $years = Years::fromRange( Year::fromString('2019'), Year::fromString(\date('2020')) ); - $author = Author::fromString($faker->name); + $holder = Holder::fromString($faker->name); $notice = Notice::fromString( <<<'EOF' @@ -87,14 +87,14 @@ public function testCreateReturnsHeaderWhenLicenseIsNotEmpty(): void $url = Url::fromString($faker->url); $header = Header::create( - $copyrightYears, - $author, + $years, + $holder, $notice, $url ); $expected = <<toString()} {$author->toString()} +Copyright (c) {$years->toString()} {$holder->toString()} {$notice->toString()} diff --git a/test/Unit/License/UrlTest.php b/test/Unit/License/UrlTest.php index 3b9eb11e..f0fa71ee 100644 --- a/test/Unit/License/UrlTest.php +++ b/test/Unit/License/UrlTest.php @@ -85,9 +85,9 @@ public function provideValidValue(): \Generator */ public function testFromStringReturnsUrlWithTrimmedValue(string $value): void { - $author = Url::fromString($value); + $url = Url::fromString($value); - self::assertSame(\trim($value), $author->toString()); + self::assertSame(\trim($value), $url->toString()); } public function provideUntrimmedValue(): \Generator