File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 55class Shipper
66{
77 private ?string $ name ;
8- private ? string $ attentionName ;
9- private ? string $ taxIdentificationNumber ;
8+ private string $ attentionName = "" ;
9+ private string $ taxIdentificationNumber = "" ;
1010 private Phone $ phone ;
1111 private ?string $ shipperNumber ;
12- private ? string $ faxNumber ;
12+ private string $ faxNumber = "" ;
1313 private Address $ address ;
1414
15+ public function __construct ()
16+ {
17+ $ this ->phone = new Phone ();
18+ }
19+
1520 public function setName (string $ name ): self
1621 {
1722 $ this ->name = mb_substr ($ name , 0 , 35 );
@@ -84,7 +89,7 @@ public function setAddress(Address $address): self
8489 return $ this ;
8590 }
8691
87- public function getAddress (): Address | null
92+ public function getAddress (): Address
8893 {
8994 return $ this ->address ;
9095 }
@@ -105,7 +110,7 @@ public function toArray(): array
105110 $ shipper ["TaxIdentificationNumber " ] = $ this ->taxIdentificationNumber ;
106111 }
107112
108- if ($ this ->phone ) {
113+ if ($ this ->phone -> exists () ) {
109114 $ shipper ["Phone " ] = $ this ->phone ->toArray ();
110115 }
111116
You can’t perform that action at this time.
0 commit comments