diff --git a/application/Espo/Core/Field/Address.php b/application/Espo/Core/Field/Address.php index 1474188ed3..be1b7f76e0 100644 --- a/application/Espo/Core/Field/Address.php +++ b/application/Espo/Core/Field/Address.php @@ -38,25 +38,13 @@ use Espo\Core\Field\Address\AddressBuilder; */ class Address { - private $street = null; - private $city = null; - private $country = null; - private $state = null; - private $postalCode = null; - public function __construct( - ?string $country = null, - ?string $state = null, - ?string $city = null, - ?string $street = null, - ?string $postalCode = null - ) { - $this->country = $country; - $this->state = $state; - $this->city = $city; - $this->street = $street; - $this->postalCode = $postalCode; - } + private ?string $country = null, + private ?string $state = null, + private ?string $city = null, + private ?string $street = null, + private ?string $postalCode = null + ) {} /** * Whether has a street. @@ -143,12 +131,10 @@ class Address */ public function withStreet(?string $street): self { - $newAddress = self::createBuilder() + return self::createBuilder() ->clone($this) ->setStreet($street) ->build(); - - return $newAddress; } /** @@ -156,12 +142,10 @@ class Address */ public function withCity(?string $city): self { - $newAddress = self::createBuilder() + return self::createBuilder() ->clone($this) ->setCity($city) ->build(); - - return $newAddress; } /** @@ -169,12 +153,10 @@ class Address */ public function withCountry(?string $country): self { - $newAddress = self::createBuilder() + return self::createBuilder() ->clone($this) ->setCountry($country) ->build(); - - return $newAddress; } /** @@ -182,12 +164,10 @@ class Address */ public function withState(?string $state): self { - $newAddress = self::createBuilder() + return self::createBuilder() ->clone($this) ->setState($state) ->build(); - - return $newAddress; } /** @@ -195,12 +175,10 @@ class Address */ public function withPostalCode(?string $postalCode): self { - $newAddress = self::createBuilder() + return self::createBuilder() ->clone($this) ->setPostalCode($postalCode) ->build(); - - return $newAddress; } /** diff --git a/application/Espo/Core/Field/Currency.php b/application/Espo/Core/Field/Currency.php index 1439e4d80d..910aad2f57 100644 --- a/application/Espo/Core/Field/Currency.php +++ b/application/Espo/Core/Field/Currency.php @@ -45,7 +45,8 @@ class Currency private string $code; /** - * @param string|float $amount + * @param string|float $amount An amount. + * @param string $code A currency code. * @throws RuntimeException */ public function __construct($amount, string $code) @@ -195,7 +196,8 @@ class Currency /** * Create from an amount and code. * - * @param string|float $amount + * @param string|float $amount An amount. + * @param string $code A currency code. * @throws RuntimeException */ public static function create($amount, string $code): self