diff --git a/src/Geo/Country.php b/src/Geo/Country.php index 2d3af33..933e2e1 100644 --- a/src/Geo/Country.php +++ b/src/Geo/Country.php @@ -267,17 +267,17 @@ class Country /** * @var string */ - private $isoCode; + protected $isoCode; /** * @var string */ - private $name; + protected $name; /** * @param string $isoCode */ - private function __construct(string $isoCode, string $name) + protected function __construct(string $isoCode, string $name) { $this->isoCode = $isoCode; $this->name = $name; @@ -296,7 +296,7 @@ public static function __callStatic(string $name, array $arguments) throw new InvalidArgumentException(sprintf('Invalid country code: %s', $isoCode)); } - return new self($isoCode, $name); + return new static($isoCode, $name); } /** diff --git a/src/Geo/Japan/Prefecture.php b/src/Geo/Japan/Prefecture.php index 3608d21..b2dd853 100644 --- a/src/Geo/Japan/Prefecture.php +++ b/src/Geo/Japan/Prefecture.php @@ -112,27 +112,27 @@ class Prefecture /** * @var string */ - private $isoCode; + protected $isoCode; /** * @var string */ - private $name; + protected $name; /** * @var string */ - private $kanjiName; + protected $kanjiName; /** * @var PrefectureSuffix */ - private $suffix; + protected $suffix; /** * @var Region */ - private $region; + protected $region; /** * @param string $isoCode @@ -141,7 +141,7 @@ class Prefecture * @param PrefectureSuffix $suffix * @param Region $region */ - private function __construct( + protected function __construct( string $isoCode, string $name, string $kanjiName, @@ -172,7 +172,7 @@ public static function __callStatic(string $name, array $arguments): self $suffixFactoryMethod = $datum['suffix']; $regionFactoryMethod = $datum['region']; - return new self( + return new static( $datum['isoCode'], $datum['name'], $datum['kanjiName'], @@ -197,7 +197,7 @@ public static function ofKanjiName(string $kanjiName): self $suffixFactoryMethod = $datum['suffix']; $regionFactoryMethod = $datum['region']; - return new self ( + return new static( $datum['isoCode'], $datum['name'], $datum['kanjiName'], @@ -229,7 +229,7 @@ public static function ofSuffixedKanjiName(string $suffixedKanjiName): self $suffixFactoryMethod = $datum['suffix']; $regionFactoryMethod = $datum['region']; - return new self ( + return new static( $datum['isoCode'], $datum['name'], $datum['kanjiName'], diff --git a/src/Geo/Japan/PrefectureSuffix.php b/src/Geo/Japan/PrefectureSuffix.php index 0e10fc5..0254f55 100644 --- a/src/Geo/Japan/PrefectureSuffix.php +++ b/src/Geo/Japan/PrefectureSuffix.php @@ -25,18 +25,18 @@ class PrefectureSuffix /** * @var string */ - private $name; + protected $name; /** * @var string */ - private $kanjiName; + protected $kanjiName; /** * @param string $name * @param string $kanjiName */ - private function __construct(string $name, string $kanjiName) + protected function __construct(string $name, string $kanjiName) { $this->name = $name; $this->kanjiName = $kanjiName; @@ -57,7 +57,7 @@ public static function __callStatic(string $name, array $arguments): self } $datum = array_shift($filteredData); - return new self($datum['name'], $datum['kanjiName']); + return new static($datum['name'], $datum['kanjiName']); } /** diff --git a/src/Geo/Japan/Region.php b/src/Geo/Japan/Region.php index a22f3e0..30f70fa 100644 --- a/src/Geo/Japan/Region.php +++ b/src/Geo/Japan/Region.php @@ -37,17 +37,18 @@ class Region /** * @var string */ - private $name; + protected $name; /** * @var string */ - private $kanjiName; + protected $kanjiName; /** - * @param array $region + * @param string $name + * @param string $kanjiName */ - private function __construct(string $name, string $kanjiName) + protected function __construct(string $name, string $kanjiName) { $this->name = $name; $this->kanjiName = $kanjiName; @@ -81,7 +82,7 @@ public static function fromName(string $name): self new InvalidArgumentException(sprintf('Invalid region name: %s', $name)) ); - return new self($datum['name'], $datum['kanjiName']); + return new static($datum['name'], $datum['kanjiName']); } /** @@ -96,7 +97,7 @@ public static function fromKanjiName(string $kanjiName): self new InvalidArgumentException(sprintf('Invalid region name in kanji: %s', $kanjiName)) ); - return new self($datum['name'], $datum['kanjiName']); + return new static($datum['name'], $datum['kanjiName']); } /** @@ -131,7 +132,7 @@ public function equals(self $other): bool * @return array * @throws Exception */ - private static function filterData(string $key, string $value, Exception $e): array + protected static function filterData(string $key, string $value, Exception $e): array { $filteredData = array_filter(self::DATA, function (array $datum) use ($key, $value) { return $value === $datum[$key]; @@ -147,8 +148,8 @@ private static function filterData(string $key, string $value, Exception $e): ar * @param array $datum * @return self */ - private static function createInstance(array $datum): self + protected static function createInstance(array $datum): self { - return new self($datum['name'], $datum['kanjiName']); + return new static($datum['name'], $datum['kanjiName']); } } diff --git a/src/Geo/Latitude.php b/src/Geo/Latitude.php index 33424e4..59493c0 100644 --- a/src/Geo/Latitude.php +++ b/src/Geo/Latitude.php @@ -9,7 +9,7 @@ class Latitude /** * @var float */ - private $latitude; + protected $latitude; /** * @param float $latitude diff --git a/src/Geo/Longitude.php b/src/Geo/Longitude.php index e1b9672..72b49ed 100644 --- a/src/Geo/Longitude.php +++ b/src/Geo/Longitude.php @@ -9,7 +9,7 @@ class Longitude /** * @var float */ - private $longitude; + protected $longitude; /** * @param float $longitude diff --git a/src/Geo/Position.php b/src/Geo/Position.php index 64753f5..b0e05d3 100644 --- a/src/Geo/Position.php +++ b/src/Geo/Position.php @@ -7,12 +7,12 @@ class Position /** * @var Latitude */ - private $latitude; + protected $latitude; /** * @var Longitude */ - private $longitude; + protected $longitude; /** * @param Latitude $latitude diff --git a/src/Money/Currency.php b/src/Money/Currency.php index 9d19228..48e213c 100644 --- a/src/Money/Currency.php +++ b/src/Money/Currency.php @@ -179,17 +179,17 @@ class Currency /** * @var string */ - private $isoCode; + protected $isoCode; /** * @var int */ - private $decimalPlaces; + protected $decimalPlaces; /** * @param string $isoCode */ - private function __construct(string $isoCode) + protected function __construct(string $isoCode) { $this->isoCode = $isoCode; if (in_array($isoCode, ['BHD', 'IQD', 'JOD', 'KWD', 'LYD', 'OMR', 'TND'])) { @@ -210,9 +210,9 @@ private function __construct(string $isoCode) /** * @param string $name * @param array $arguments - * @return self + * @return Currency */ - public static function __callStatic(string $name, array $arguments) + public static function __callStatic(string $name, array $arguments): Currency { $isoCode = strtoupper($name); $name = Intl::getCurrencyBundle()->getCurrencyName($isoCode); @@ -220,7 +220,7 @@ public static function __callStatic(string $name, array $arguments) throw new InvalidArgumentException(sprintf('Invalid currency code: %s', $isoCode)); } - return new self($isoCode); + return new static($isoCode); } /** diff --git a/src/Money/Money.php b/src/Money/Money.php index f32dda7..c234bd8 100644 --- a/src/Money/Money.php +++ b/src/Money/Money.php @@ -9,12 +9,12 @@ class Money /** * @var int */ - private $amount; + protected $amount; /** * @var Currency */ - private $currency; + protected $currency; /** * @param int $amount @@ -52,18 +52,18 @@ public function equals(self $other): bool } /** - * @return self + * @return Money */ - public function duplicate(): self + public function duplicate() { - return new self($this->amount(), $this->currency()); + return new static($this->amount(), $this->currency()); } /** * @param self $other - * @return self + * @return Money */ - public function add(self $other): self + public function add(self $other): Money { if (!$this->currency()->equals($other->currency())) { throw new InvalidArgumentException( @@ -75,7 +75,7 @@ public function add(self $other): self ); } - return new self($this->amount() + $other->amount(), $this->currency()); + return new static($this->amount() + $other->amount(), $this->currency()); } /** @@ -94,7 +94,7 @@ public function sub(self $other): self ); } - return new self($this->amount() - $other->amount(), $this->currency()); + return new static($this->amount() - $other->amount(), $this->currency()); } /** @@ -103,7 +103,7 @@ public function sub(self $other): self */ public function multiply(float $multiplier): self { - return new self(intval(floor($this->amount() * $multiplier)), $this->currency()); + return new static(intval(floor($this->amount() * $multiplier)), $this->currency()); } /** @@ -121,7 +121,7 @@ public function increaseAmountBy(int $amount): self ); } - return new self($this->amount() + $amount, $this->currency()); + return new static($this->amount() + $amount, $this->currency()); } /** @@ -139,6 +139,6 @@ public function decreaseAmountBy(int $amount): self ); } - return new self($this->amount() - $amount, $this->currency()); + return new static($this->amount() - $amount, $this->currency()); } } diff --git a/src/Time/Date.php b/src/Time/Date.php index 88dffb1..a25de6d 100644 --- a/src/Time/Date.php +++ b/src/Time/Date.php @@ -12,17 +12,17 @@ class Date /** * @var int */ - private $year; + protected $year; /** * @var int */ - private $month; + protected $month; /** * @var int */ - private $day; + protected $day; /** * @param int $year diff --git a/src/Time/TimeLength.php b/src/Time/TimeLength.php index c72a50b..756ec4b 100644 --- a/src/Time/TimeLength.php +++ b/src/Time/TimeLength.php @@ -9,12 +9,12 @@ class TimeLength /** * @var int */ - private $lengthInSeconds; + protected $lengthInSeconds; /** * @param int $lengthInSeconds */ - private function __construct(int $lengthInSeconds) + protected function __construct(int $lengthInSeconds) { if (!($lengthInSeconds >= 0)) { throw new InvalidArgumentException(sprintf('Length cannot be negative in seconds: %s', $lengthInSeconds)); @@ -25,38 +25,38 @@ private function __construct(int $lengthInSeconds) /** * @param int $seconds - * @return self + * @return TimeLength */ - public static function ofSeconds(int $seconds): self + public static function ofSeconds(int $seconds): TimeLength { - return new self($seconds); + return new static($seconds); } /** * @param int $minutes - * @return self + * @return TimeLength */ - public static function ofMinutes(int $minutes): self + public static function ofMinutes(int $minutes): TimeLength { - return new self($minutes * 60); + return new static($minutes * 60); } /** * @param int $hours - * @return self + * @return TimeLength */ - public static function ofHours(int $hours): self + public static function ofHours(int $hours): TimeLength { - return new self($hours * 3600); + return new static($hours * 3600); } /** * @param int $days - * @return self + * @return TimeLength */ - public static function ofDays(int $days): self + public static function ofDays(int $days): TimeLength { - return new self($days * 86400); + return new static($days * 86400); } /** diff --git a/src/Time/TimeOfDay.php b/src/Time/TimeOfDay.php index d217e33..177553c 100644 --- a/src/Time/TimeOfDay.php +++ b/src/Time/TimeOfDay.php @@ -9,17 +9,17 @@ class TimeOfDay /** * @var int */ - private $hours; + protected $hours; /** * @var int */ - private $minutes; + protected $minutes; /** * @var int */ - private $seconds; + protected $seconds; /** * @param int $hours diff --git a/src/Time/TimeRange.php b/src/Time/TimeRange.php index f1813bf..a71bcd7 100644 --- a/src/Time/TimeRange.php +++ b/src/Time/TimeRange.php @@ -10,12 +10,12 @@ class TimeRange /** * @var DateTimeImmutable */ - private $start; + protected $start; /** * @var DateTimeImmutable */ - private $end; + protected $end; /** * @param DateTimeImmutable $start diff --git a/src/Time/TimeRangeOfDay.php b/src/Time/TimeRangeOfDay.php index 1e561e5..c381861 100644 --- a/src/Time/TimeRangeOfDay.php +++ b/src/Time/TimeRangeOfDay.php @@ -9,12 +9,12 @@ class TimeRangeOfDay /** * @var TimeOfDay */ - private $start; + protected $start; /** * @var TimeOfDay */ - private $end; + protected $end; /** * @param TimeOfDay $start @@ -94,7 +94,7 @@ public function overlapping(self $other): self $start = $this->start()->isAfter($other->start()) ? $this->start() : $other->start(); $end = $this->end()->isBefore($other->end()) ? $this->end() : $other->end(); - return new self($start, $end); + return new static($start, $end); } /** @@ -102,7 +102,7 @@ public function overlapping(self $other): self */ public static function am(): self { - return new self(new TimeOfDay(0), new TimeOfDay(12)); + return new static(new TimeOfDay(0), new TimeOfDay(12)); } /** @@ -110,7 +110,7 @@ public static function am(): self */ public static function pm(): self { - return new self(new TimeOfDay(12), new TimeOfDay(23, 59, 0)); + return new static(new TimeOfDay(12), new TimeOfDay(23, 59, 0)); } /** @@ -118,6 +118,6 @@ public static function pm(): self */ public static function allDay(): self { - return new self(new TimeOfDay(0), new TimeOfDay(23, 59, 59)); + return new static(new TimeOfDay(0), new TimeOfDay(23, 59, 59)); } } diff --git a/src/Web/Email.php b/src/Web/Email.php index 14a21c7..3fe2c3a 100644 --- a/src/Web/Email.php +++ b/src/Web/Email.php @@ -46,7 +46,7 @@ class Email * @param EmailAddress[] $tos * @param EmailAddress[] $ccs * @param EmailAddress[] $bccs - * @param EmailAttachment $attachments + * @param EmailAttachment[] $attachments */ public function __construct( string $subject, diff --git a/src/Web/EmailAddress.php b/src/Web/EmailAddress.php index 46f55a2..4bdd7a4 100644 --- a/src/Web/EmailAddress.php +++ b/src/Web/EmailAddress.php @@ -9,7 +9,7 @@ class EmailAddress /** * @var string */ - private $emailAddress; + protected $emailAddress; /** * @param string $emailAddress @@ -46,7 +46,7 @@ public function emailAddress(): string * @param string $emailAddress * @return bool */ - private function validateSoft(string $emailAddress): bool + protected function validateSoft(string $emailAddress): bool { return preg_match('/^.+\@\S+\.\S+$/', $emailAddress); } @@ -55,7 +55,7 @@ private function validateSoft(string $emailAddress): bool * @param string $emailAddress * @return bool */ - private function validateStrict(string $emailAddress): bool + protected function validateStrict(string $emailAddress): bool { return filter_var($emailAddress, FILTER_VALIDATE_EMAIL); } diff --git a/src/Web/EmailAttachment.php b/src/Web/EmailAttachment.php index fce662a..9544b58 100644 --- a/src/Web/EmailAttachment.php +++ b/src/Web/EmailAttachment.php @@ -153,21 +153,21 @@ class EmailAttachment /** * @var string */ - private $content; + protected $content; /** * @var string */ - private $fileName; + protected $fileName; /** * @var string */ - private $mimeType; + protected $mimeType; /** * @param string $content - * @param string $filename + * @param string $fileName */ public function __construct(string $content, string $fileName) { diff --git a/src/Web/HttpMethod.php b/src/Web/HttpMethod.php index de86683..9a4338b 100644 --- a/src/Web/HttpMethod.php +++ b/src/Web/HttpMethod.php @@ -52,12 +52,12 @@ class HttpMethod /** * @var string */ - private $httpMethod; + protected $httpMethod; /** * @param string $httpMethod */ - private function __construct(string $httpMethod) + protected function __construct(string $httpMethod) { $this->httpMethod = $httpMethod; } @@ -67,7 +67,7 @@ private function __construct(string $httpMethod) */ public static function get(): self { - return new self(self::GET); + return new static(self::GET); } /** @@ -75,7 +75,7 @@ public static function get(): self */ public static function head(): self { - return new self(self::HEAD); + return new static(self::HEAD); } /** @@ -83,7 +83,7 @@ public static function head(): self */ public static function post(): self { - return new self(self::POST); + return new static(self::POST); } /** @@ -91,7 +91,7 @@ public static function post(): self */ public static function put(): self { - return new self(self::PUT); + return new static(self::PUT); } /** @@ -99,7 +99,7 @@ public static function put(): self */ public static function delete(): self { - return new self(self::DELETE); + return new static(self::DELETE); } /** @@ -107,7 +107,7 @@ public static function delete(): self */ public static function connect(): self { - return new self(self::CONNECT); + return new static(self::CONNECT); } /** @@ -115,7 +115,7 @@ public static function connect(): self */ public static function options(): self { - return new self(self::OPTIONS); + return new static(self::OPTIONS); } /** @@ -123,7 +123,7 @@ public static function options(): self */ public static function trace(): self { - return new self(self::TRACE); + return new static(self::TRACE); } /** @@ -131,7 +131,7 @@ public static function trace(): self */ public static function patch(): self { - return new self(self::PATCH); + return new static(self::PATCH); } /** diff --git a/src/Web/IpAddressV4.php b/src/Web/IpAddressV4.php index b9f92bb..7b2dea0 100644 --- a/src/Web/IpAddressV4.php +++ b/src/Web/IpAddressV4.php @@ -9,7 +9,7 @@ class IpAddressV4 /** * @var string */ - private $ipAddressV4; + protected $ipAddressV4; /** * @param string $ipAddressV4 diff --git a/src/Web/IpAddressV6.php b/src/Web/IpAddressV6.php index 6575250..7fa8859 100644 --- a/src/Web/IpAddressV6.php +++ b/src/Web/IpAddressV6.php @@ -9,7 +9,7 @@ class IpAddressV6 /** * @var string */ - private $ipAddressV6; + protected $ipAddressV6; /** * @param string $ipAddressV6 diff --git a/src/Web/Url.php b/src/Web/Url.php index c84aec7..7111632 100644 --- a/src/Web/Url.php +++ b/src/Web/Url.php @@ -9,7 +9,7 @@ class Url /** * @var string */ - private $url; + protected $url; /** * @param string $url