Skip to content

Commit 1d7d6a2

Browse files
author
Eduard Duran
committed
Adds support for PHP8.1 return types
1 parent f70a82e commit 1d7d6a2

File tree

8 files changed

+17
-16
lines changed

8 files changed

+17
-16
lines changed

src/Types/GeometryCollection.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Contracts\Support\Arrayable;
1212
use InvalidArgumentException;
1313
use IteratorAggregate;
14+
use Traversable;
1415

1516
class GeometryCollection extends Geometry implements IteratorAggregate, ArrayAccess, Arrayable, Countable
1617
{
@@ -87,22 +88,22 @@ public function toArray()
8788
return $this->items;
8889
}
8990

90-
public function getIterator()
91+
public function getIterator(): Traversable
9192
{
9293
return new ArrayIterator($this->items);
9394
}
9495

95-
public function offsetExists($offset)
96+
public function offsetExists($offset): bool
9697
{
9798
return isset($this->items[$offset]);
9899
}
99100

100-
public function offsetGet($offset)
101+
public function offsetGet($offset): mixed
101102
{
102103
return $this->offsetExists($offset) ? $this->items[$offset] : null;
103104
}
104105

105-
public function offsetSet($offset, $value)
106+
public function offsetSet($offset, $value): void
106107
{
107108
$this->validateItemType($value);
108109

@@ -113,12 +114,12 @@ public function offsetSet($offset, $value)
113114
}
114115
}
115116

116-
public function offsetUnset($offset)
117+
public function offsetUnset($offset): void
117118
{
118119
unset($this->items[$offset]);
119120
}
120121

121-
public function count()
122+
public function count(): int
122123
{
123124
return count($this->items);
124125
}
@@ -146,7 +147,7 @@ public static function fromJson($geoJson)
146147
*
147148
* @return \GeoJson\Geometry\GeometryCollection
148149
*/
149-
public function jsonSerialize()
150+
public function jsonSerialize(): mixed
150151
{
151152
$geometries = [];
152153
foreach ($this->items as $geometry) {

src/Types/LineString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static function fromJson($geoJson)
6565
*
6666
* @return \GeoJson\Geometry\LineString
6767
*/
68-
public function jsonSerialize()
68+
public function jsonSerialize(): mixed
6969
{
7070
$points = [];
7171
foreach ($this->items as $point) {

src/Types/MultiLineString.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __toString()
4949
}, $this->getLineStrings()));
5050
}
5151

52-
public function offsetSet($offset, $value)
52+
public function offsetSet($offset, $value): void
5353
{
5454
$this->validateItemType($value);
5555

@@ -83,7 +83,7 @@ public static function fromJson($geoJson)
8383
*
8484
* @return \GeoJson\Geometry\MultiLineString
8585
*/
86-
public function jsonSerialize()
86+
public function jsonSerialize(): mixed
8787
{
8888
$lineStrings = [];
8989

src/Types/MultiPoint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static function fromJson($geoJson)
6969
*
7070
* @return \GeoJson\Geometry\MultiPoint
7171
*/
72-
public function jsonSerialize()
72+
public function jsonSerialize(): mixed
7373
{
7474
$points = [];
7575
foreach ($this->items as $point) {

src/Types/MultiPolygon.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected static function assembleParts(array $parts)
8989
return $polygons;
9090
}
9191

92-
public function offsetSet($offset, $value)
92+
public function offsetSet($offset, $value): void
9393
{
9494
$this->validateItemType($value);
9595

@@ -127,7 +127,7 @@ public static function fromJson($geoJson)
127127
*
128128
* @return \GeoJson\Geometry\MultiPolygon
129129
*/
130-
public function jsonSerialize()
130+
public function jsonSerialize(): mixed
131131
{
132132
$polygons = [];
133133
foreach ($this->items as $polygon) {

src/Types/Point.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static function fromJson($geoJson)
9292
*
9393
* @return \GeoJson\Geometry\Point
9494
*/
95-
public function jsonSerialize()
95+
public function jsonSerialize(): mixed
9696
{
9797
return new GeoJsonPoint([$this->getLng(), $this->getLat()]);
9898
}

src/Types/PointCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function toPairList()
2121
}, $this->items));
2222
}
2323

24-
public function offsetSet($offset, $value)
24+
public function offsetSet($offset, $value): void
2525
{
2626
$this->validateItemType($value);
2727

src/Types/Polygon.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static function fromJson($geoJson)
4040
*
4141
* @return \GeoJson\Geometry\Polygon
4242
*/
43-
public function jsonSerialize()
43+
public function jsonSerialize(): mixed
4444
{
4545
$linearRings = [];
4646
foreach ($this->items as $lineString) {

0 commit comments

Comments
 (0)