Skip to content

Commit

Permalink
use readonly properties (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
gharlan committed Jan 2, 2022
1 parent 58a631f commit 047f5bf
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Base/CompareTrait.php
Expand Up @@ -12,7 +12,7 @@
*/
trait CompareTrait
{
private \DateTimeImmutable $dateTime;
private readonly \DateTimeImmutable $dateTime;

/** @psalm-pure */
public static function min(self $object, self ...$objects): self
Expand Down
2 changes: 1 addition & 1 deletion src/Base/DateTrait.php
Expand Up @@ -14,7 +14,7 @@
*/
trait DateTrait
{
private \DateTimeImmutable $dateTime;
private readonly \DateTimeImmutable $dateTime;

abstract private function __construct(\DateTimeImmutable $dateTime);

Expand Down
2 changes: 1 addition & 1 deletion src/Base/EnumTrait.php
Expand Up @@ -13,7 +13,7 @@
*/
trait EnumTrait
{
private int $index;
private readonly int $index;

private function __construct(int $index)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Base/FormatTrait.php
Expand Up @@ -10,7 +10,7 @@
*/
trait FormatTrait
{
private \DateTimeImmutable $dateTime;
private readonly \DateTimeImmutable $dateTime;

public function __toString(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Base/ModifyTrait.php
Expand Up @@ -12,7 +12,7 @@
*/
trait ModifyTrait
{
private \DateTimeImmutable $dateTime;
private readonly \DateTimeImmutable $dateTime;

public function modify(string $modify): self
{
Expand Down
2 changes: 1 addition & 1 deletion src/Base/TimeTrait.php
Expand Up @@ -12,7 +12,7 @@
*/
trait TimeTrait
{
private \DateTimeImmutable $dateTime;
private readonly \DateTimeImmutable $dateTime;

public function getHour(): int
{
Expand Down
2 changes: 1 addition & 1 deletion src/Date.php
Expand Up @@ -21,7 +21,7 @@ final class Date implements \JsonSerializable, \Stringable
use Base\FormatTrait;
use Base\ModifyTrait;

private \DateTimeImmutable $dateTime;
private readonly \DateTimeImmutable $dateTime;

private function __construct(\DateTimeImmutable $dateTime)
{
Expand Down
4 changes: 2 additions & 2 deletions src/DateTime.php
Expand Up @@ -22,8 +22,8 @@ final class DateTime implements \JsonSerializable, \Stringable
use Base\ModifyTrait;
use Base\TimeTrait;

private \DateTimeImmutable $dateTime;
private TimeZone $timeZone;
private readonly \DateTimeImmutable $dateTime;
private readonly TimeZone $timeZone;

private function __construct(\DateTimeImmutable $dateTime, ?TimeZone $timeZone = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Duration.php
Expand Up @@ -12,7 +12,7 @@
*/
final class Duration implements \JsonSerializable, \Stringable
{
private \DateInterval $interval;
private readonly \DateInterval $interval;

private function __construct(\DateInterval $interval)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Time.php
Expand Up @@ -23,7 +23,7 @@ final class Time implements \JsonSerializable, \Stringable

private const DATE = '1970-01-01';

private \DateTimeImmutable $dateTime;
private readonly \DateTimeImmutable $dateTime;

private function __construct(\DateTimeImmutable $dateTime)
{
Expand Down
2 changes: 1 addition & 1 deletion src/TimeZone.php
Expand Up @@ -11,7 +11,7 @@
*/
final class TimeZone implements \JsonSerializable, \Stringable
{
private \DateTimeZone $timeZone;
private readonly \DateTimeZone $timeZone;

private function __construct(\DateTimeZone $timeZone)
{
Expand Down

0 comments on commit 047f5bf

Please sign in to comment.