Skip to content

Commit

Permalink
Fix: Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Jan 2, 2020
1 parent 5296fec commit 9275e54
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 66 deletions.
4 changes: 2 additions & 2 deletions .php_cs
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/License/Author.php → src/License/Copyright/Holder.php
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/License/Year.php → src/License/Copyright/Year.php
Expand Up @@ -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
Expand Down
Expand Up @@ -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;

Expand Down
20 changes: 10 additions & 10 deletions src/License/Header.php
Expand Up @@ -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
);
Expand All @@ -48,14 +48,14 @@ public function toString(): string
{
if ($this->notice->isEmpty()) {
return <<<EOF
Copyright (c) {$this->copyrightYears->toString()} {$this->author->toString()}
Copyright (c) {$this->years->toString()} {$this->holder->toString()}
@see {$this->url->toString()}
EOF;
}

return <<<EOF
Copyright (c) {$this->copyrightYears->toString()} {$this->author->toString()}
Copyright (c) {$this->years->toString()} {$this->holder->toString()}
{$this->notice->toString()}
Expand Down
Expand Up @@ -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;

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Expand Up @@ -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
{
Expand Down
Expand Up @@ -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;

Expand All @@ -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
);
Expand All @@ -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());
}
}
32 changes: 16 additions & 16 deletions test/Unit/License/HeaderTest.php
Expand Up @@ -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;

Expand All @@ -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
{
Expand All @@ -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 = <<<EOF
Copyright (c) {$copyrightYears->toString()} {$author->toString()}
Copyright (c) {$years->toString()} {$holder->toString()}
@see {$url->toString()}
EOF;
Expand All @@ -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'
Expand All @@ -87,14 +87,14 @@ public function testCreateReturnsHeaderWhenLicenseIsNotEmpty(): void
$url = Url::fromString($faker->url);

$header = Header::create(
$copyrightYears,
$author,
$years,
$holder,
$notice,
$url
);

$expected = <<<EOF
Copyright (c) {$copyrightYears->toString()} {$author->toString()}
Copyright (c) {$years->toString()} {$holder->toString()}
{$notice->toString()}
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/License/UrlTest.php
Expand Up @@ -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
Expand Down

0 comments on commit 9275e54

Please sign in to comment.