Skip to content

Commit b6667d8

Browse files
authored
Merge pull request #189 from maxmind/revert-187-greg/fix-json-serialize-return-type
Revert "Update jsonSerialize return type. Closes #185"
2 parents 7598c36 + 0e5d182 commit b6667d8

File tree

3 files changed

+2
-21
lines changed

3 files changed

+2
-21
lines changed

CHANGELOG.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
CHANGELOG
22
=========
33

4-
2.13.0
5-
-------------------
6-
7-
* The return types on the `jsonSerialize` implementations have been remove
8-
to that they do not conflict with `JsonSerializable::jsonSerialize` on PHP
9-
8+. Reported by Gokul Hegde. GitHub #185.
10-
114
2.12.2 (2021-11-30)
125
-------------------
136

src/Model/AbstractModel.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,7 @@ public function __isset(string $attr): bool
6161
return $attr !== 'instance' && isset($this->{$attr});
6262
}
6363

64-
/**
65-
* @return mixed data that can be serialized by json_encode
66-
*/
67-
// We don't specify a return type here as PHP 8 has "mixed" as the return
68-
// type for "JsonSerializable::jsonSerialize", but PHP 7 doesn't support
69-
// "mixed".
70-
public function jsonSerialize()
64+
public function jsonSerialize(): array
7165
{
7266
return $this->raw;
7367
}

src/Record/AbstractRecord.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,7 @@ private function validAttribute(string $attr): bool
6060
return \in_array($attr, $this->validAttributes, true);
6161
}
6262

63-
/**
64-
* @return mixed data that can be serialized by json_encode
65-
*/
66-
// We don't specify a return type here as PHP 8 has "mixed" as the return
67-
// type for "JsonSerializable::jsonSerialize", but PHP 7 doesn't support
68-
// "mixed".
69-
public function jsonSerialize()
63+
public function jsonSerialize(): ?array
7064
{
7165
return $this->record;
7266
}

0 commit comments

Comments
 (0)