Skip to content

Commit f9c7932

Browse files
authored
Merge pull request #11 from pmzandbergen/patch-1
Fix: PHP 8.1 JsonSerializable compatibility
2 parents b02d66a + 765f7bc commit f9c7932

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

src/Model/Collection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ public function count()
5555
* which is a value of any type other than a resource.
5656
* @since 5.4.0
5757
*/
58+
#[\ReturnTypeWillChange]
5859
public function jsonSerialize()
5960
{
6061
if ($this->key !== null) {
6162
return [$this->key => $this->elements];
6263
}
6364
return $this->elements;
6465
}
65-
}
66+
}

src/Model/Customer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ public function __toString(): string
235235
* which is a value of any type other than a resource.
236236
* @since 5.4.0
237237
*/
238-
function jsonSerialize()
238+
#[\ReturnTypeWillChange]
239+
public function jsonSerialize()
239240
{
240241
$data = [
241242
'email_address' => $this->emailAddress,

src/Model/Order.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ public function addDetailsView(DetailsView $detailsView)
321321
* which is a value of any type other than a resource.
322322
* @since 5.4.0
323323
*/
324+
#[\ReturnTypeWillChange]
324325
public function jsonSerialize()
325326
{
326327
$data = [

src/Model/Order/DetailsView.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public function setDateFormat(string $dateFormat)
106106
* which is a value of any type other than a resource.
107107
* @since 5.4.0
108108
*/
109+
#[\ReturnTypeWillChange]
109110
public function jsonSerialize()
110111
{
111112
$data = ['display_as' => $this->displayAs];
@@ -123,4 +124,4 @@ public function jsonSerialize()
123124

124125
return $data;
125126
}
126-
}
127+
}

src/Model/SearchResult.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ public function __construct(Collection $customerCollection, Collection $orderCol
3939
* which is a value of any type other than a resource.
4040
* @since 5.4.0
4141
*/
42+
#[\ReturnTypeWillChange]
4243
public function jsonSerialize()
4344
{
4445
return [
4546
'customers' => $this->customerCollection,
4647
'orders' => $this->orderCollection
4748
];
4849
}
49-
}
50+
}

0 commit comments

Comments
 (0)