diff --git a/src/Collections/PaymentMethods.php b/src/Collections/PaymentMethods.php index 7849cc8fc..ff1d41a34 100644 --- a/src/Collections/PaymentMethods.php +++ b/src/Collections/PaymentMethods.php @@ -36,7 +36,7 @@ class PaymentMethods extends UserOwnedCollection * @throws TerminusException When there is more than one matching payment method * @throws TerminusNotFoundException When there are no matching payment methods */ - public function get($id): ?TerminusModel + public function get($id): TerminusModel { $payment_methods = $this->all(); if (isset($payment_methods[$id])) { diff --git a/src/Collections/TerminusCollection.php b/src/Collections/TerminusCollection.php index 33130314b..9ca0191e0 100644 --- a/src/Collections/TerminusCollection.php +++ b/src/Collections/TerminusCollection.php @@ -94,6 +94,10 @@ public function all() public function fetch() { foreach ($this->getData() as $id => $model_data) { + if (!$id && !is_object($model_data)) { + // Empty model, just skip it. + continue; + } if (!is_object($model_data)) { // This should always be an object, however occasionally it is returning as a string // We need more information about what it is and to handle the error