1616class CustomField extends AbstractApi
1717{
1818 /**
19- * @var array<mixed>
19+ * @var null| array<mixed>
2020 */
21- private $ customFields = [] ;
21+ private ? array $ customFields = null ;
2222
2323 /**
2424 * @var null|array<int,string>
2525 */
26- private $ customFieldNames = null ;
26+ private ? array $ customFieldNames = null ;
2727
2828 /**
2929 * List custom fields.
@@ -83,7 +83,7 @@ final public function listNames(): array
8383 */
8484 public function all (array $ params = [])
8585 {
86- @trigger_error ('` ' . __METHOD__ . '()` is deprecated since v2.4.0, use ` ' . __CLASS__ . '::list()` instead. ' , E_USER_DEPRECATED );
86+ @trigger_error ('` ' . __METHOD__ . '()` is deprecated since v2.4.0, use ` ' . self ::class . '::list()` instead. ' , E_USER_DEPRECATED );
8787
8888 try {
8989 $ this ->customFields = $ this ->list ($ params );
@@ -92,7 +92,7 @@ public function all(array $params = [])
9292 return false ;
9393 }
9494
95- if ($ e instanceof UnexpectedResponseException && $ e ->getPrevious () !== null ) {
95+ if ($ e instanceof UnexpectedResponseException && $ e ->getPrevious () instanceof \Throwable ) {
9696 $ e = $ e ->getPrevious ();
9797 }
9898
@@ -115,7 +115,7 @@ public function all(array $params = [])
115115 */
116116 public function listing ($ forceUpdate = false , array $ params = [])
117117 {
118- @trigger_error ('` ' . __METHOD__ . '()` is deprecated since v2.7.0, use ` ' . __CLASS__ . '::listNames()` instead. ' , E_USER_DEPRECATED );
118+ @trigger_error ('` ' . __METHOD__ . '()` is deprecated since v2.7.0, use ` ' . self ::class . '::listNames()` instead. ' , E_USER_DEPRECATED );
119119
120120 return $ this ->doListing ($ forceUpdate , $ params );
121121 }
@@ -133,7 +133,7 @@ public function listing($forceUpdate = false, array $params = [])
133133 */
134134 public function getIdByName ($ name , array $ params = [])
135135 {
136- @trigger_error ('` ' . __METHOD__ . '()` is deprecated since v2.7.0, use ` ' . __CLASS__ . '::listNames()` instead. ' , E_USER_DEPRECATED );
136+ @trigger_error ('` ' . __METHOD__ . '()` is deprecated since v2.7.0, use ` ' . self ::class . '::listNames()` instead. ' , E_USER_DEPRECATED );
137137
138138 $ arr = $ this ->doListing (false , $ params );
139139
@@ -151,7 +151,7 @@ public function getIdByName($name, array $params = [])
151151 */
152152 private function doListing (bool $ forceUpdate , array $ params ): array
153153 {
154- if (empty ( $ this ->customFields ) || $ forceUpdate ) {
154+ if ($ forceUpdate || $ this ->customFields === null ) {
155155 $ this ->customFields = $ this ->list ($ params );
156156 }
157157
0 commit comments