File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010use SupportPal \ApiClient \Exception \MissingIdentifierException ;
1111use SupportPal \ApiClient \Model \Collection \Collection ;
1212use SupportPal \ApiClient \Model \Ticket \Attachment ;
13+ use TypeError ;
1314
1415use function array_map ;
1516
@@ -52,11 +53,13 @@ public function getAttachment(int $attachmentId): Attachment
5253 */
5354 public function downloadAttachment (Attachment $ attachment ): StreamInterface
5455 {
55- if ($ attachment ->getId () === null ) {
56+ try {
57+ $ attachmentId = $ attachment ->getId ();
58+ } catch (TypeError $ typeError ) {
5659 throw new MissingIdentifierException ('missing attachment identifier ' );
5760 }
5861
59- return $ this ->getApiClient ()->downloadAttachment ($ attachment -> getId () )->getBody ();
62+ return $ this ->getApiClient ()->downloadAttachment ($ attachmentId )->getBody ();
6063 }
6164
6265 /**
Original file line number Diff line number Diff line change 1111use SupportPal \ApiClient \Model \Ticket \Request \CreateTicket ;
1212use SupportPal \ApiClient \Model \Ticket \Ticket ;
1313use Symfony \Component \PropertyAccess \Exception \UninitializedPropertyException ;
14+ use TypeError ;
1415
1516use function array_map ;
1617
@@ -54,11 +55,13 @@ public function getTicket(int $ticketId): Ticket
5455 */
5556 public function updateTicket (Ticket $ ticket , array $ data ): Ticket
5657 {
57- if ($ ticket ->getId () === null ) {
58+ try {
59+ $ ticketId = $ ticket ->getId ();
60+ } catch (TypeError $ typeError ) {
5861 throw new MissingIdentifierException ('missing ticket identifier ' );
5962 }
6063
61- $ response = $ this ->getApiClient ()->updateTicket ($ ticket -> getId () , $ data );
64+ $ response = $ this ->getApiClient ()->updateTicket ($ ticketId , $ data );
6265
6366 return $ this ->createTicket ($ this ->decodeBody ($ response )['data ' ]);
6467 }
Original file line number Diff line number Diff line change 1111use SupportPal \ApiClient \Model \User \Request \CreateUser ;
1212use SupportPal \ApiClient \Model \User \User ;
1313use Symfony \Component \PropertyAccess \Exception \UninitializedPropertyException ;
14+ use TypeError ;
1415
1516use function array_map ;
1617
@@ -54,11 +55,13 @@ public function getUser(int $userId): User
5455 */
5556 public function updateUser (User $ user , array $ data ): User
5657 {
57- if ($ user ->getId () === null ) {
58+ try {
59+ $ userId = $ user ->getId ();
60+ } catch (TypeError $ typeError ) {
5861 throw new MissingIdentifierException ('missing user identifier ' );
5962 }
6063
61- $ response = $ this ->getApiClient ()->updateUser ($ user -> getId () , $ data );
64+ $ response = $ this ->getApiClient ()->updateUser ($ userId , $ data );
6265
6366 return $ this ->createUser ($ this ->decodeBody ($ response )['data ' ]);
6467 }
Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ class Brand extends BaseModel
203203 private $ defaultTimezone ;
204204
205205 /**
206- * @var int|null
206+ * @var int
207207 * @SerializedName("id")
208208 */
209209 private $ id ;
@@ -777,18 +777,18 @@ public function setDefaultTimezone(string $defaultTimezone): self
777777 }
778778
779779 /**
780- * @return int|null
780+ * @return int
781781 */
782- public function getId (): ? int
782+ public function getId (): int
783783 {
784784 return $ this ->id ;
785785 }
786786
787787 /**
788- * @param int|null $id
788+ * @param int $id
789789 * @return self
790790 */
791- public function setId (? int $ id ): self
791+ public function setId (int $ id ): self
792792 {
793793 $ this ->id = $ id ;
794794
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ class Department extends BaseModel
5656 private $ notifyEmailTicket ;
5757
5858 /**
59- * @var int|null
59+ * @var int
6060 * @SerializedName("id")
6161 */
6262 private $ id ;
@@ -289,18 +289,18 @@ public function setNotifyEmailTicket(bool $notifyEmailTicket): self
289289 }
290290
291291 /**
292- * @return int|null
292+ * @return int
293293 */
294- public function getId (): ? int
294+ public function getId (): int
295295 {
296296 return $ this ->id ;
297297 }
298298
299299 /**
300- * @param int|null $id
300+ * @param int $id
301301 * @return self
302302 */
303- public function setId (? int $ id ): self
303+ public function setId (int $ id ): self
304304 {
305305 $ this ->id = $ id ;
306306
Original file line number Diff line number Diff line change 1414class Email extends BaseModel
1515{
1616 /**
17- * @var int|null
17+ * @var int
1818 * @SerializedName("id")
1919 */
2020 private $ id ;
@@ -116,18 +116,18 @@ class Email extends BaseModel
116116 private $ authMech ;
117117
118118 /**
119- * @return int|null
119+ * @return int
120120 */
121- public function getId (): ? int
121+ public function getId (): int
122122 {
123123 return $ this ->id ;
124124 }
125125
126126 /**
127- * @param int|null $id
127+ * @param int $id
128128 * @return self
129129 */
130- public function setId (? int $ id ): self
130+ public function setId (int $ id ): self
131131 {
132132 $ this ->id = $ id ;
133133
Original file line number Diff line number Diff line change @@ -159,9 +159,9 @@ class Article extends BaseModel
159159 private $ totalRating ;
160160
161161 /**
162- * @return int|null
162+ * @return int
163163 */
164- public function getId (): ? int
164+ public function getId (): int
165165 {
166166 return $ this ->id ;
167167 }
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class Comment extends BaseModel
2020 ];
2121
2222 /**
23- * @var int|null
23+ * @var int
2424 * @SerializedName("id")
2525 */
2626 private $ id ;
@@ -122,9 +122,9 @@ class Comment extends BaseModel
122122 private $ rating ;
123123
124124 /**
125- * @return int|null
125+ * @return int
126126 */
127- public function getId (): ? int
127+ public function getId (): int
128128 {
129129 return $ this ->id ;
130130 }
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class Type extends BaseModel
2727 private $ icon ;
2828
2929 /**
30- * @var int|null
30+ * @var int
3131 * @SerializedName("id")
3232 */
3333 private $ id ;
@@ -154,18 +154,18 @@ public function setIcon(?string $icon): self
154154 }
155155
156156 /**
157- * @return int|null
157+ * @return int
158158 */
159- public function getId (): ? int
159+ public function getId (): int
160160 {
161161 return $ this ->id ;
162162 }
163163
164164 /**
165- * @param int|null $id
165+ * @param int $id
166166 * @return self
167167 */
168- public function setId (? int $ id ): self
168+ public function setId (int $ id ): self
169169 {
170170 $ this ->id = $ id ;
171171
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ abstract class CustomField extends BaseModel
7373 private $ dependsOnOptionId ;
7474
7575 /**
76- * @var int|null
76+ * @var int
7777 * @SerializedName("id")
7878 */
7979 private $ id ;
@@ -272,18 +272,18 @@ public function setDependsOnOptionId(?int $dependsOnOptionId): self
272272 }
273273
274274 /**
275- * @return int|null
275+ * @return int
276276 */
277- public function getId (): ? int
277+ public function getId (): int
278278 {
279279 return $ this ->id ;
280280 }
281281
282282 /**
283- * @param int|null $id
283+ * @param int $id
284284 * @return self
285285 */
286- public function setId (? int $ id ): self
286+ public function setId (int $ id ): self
287287 {
288288 $ this ->id = $ id ;
289289
You can’t perform that action at this time.
0 commit comments