diff --git a/src/Types/GeometryCollection.php b/src/Types/GeometryCollection.php index 35f093f7..264536d0 100755 --- a/src/Types/GeometryCollection.php +++ b/src/Types/GeometryCollection.php @@ -11,6 +11,7 @@ use Illuminate\Contracts\Support\Arrayable; use InvalidArgumentException; use IteratorAggregate; +use Traversable; class GeometryCollection extends Geometry implements IteratorAggregate, ArrayAccess, Arrayable, Countable { @@ -87,22 +88,22 @@ public function toArray() return $this->items; } - public function getIterator() + public function getIterator(): Traversable { return new ArrayIterator($this->items); } - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->items[$offset]); } - public function offsetGet($offset) + public function offsetGet($offset): mixed { return $this->offsetExists($offset) ? $this->items[$offset] : null; } - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { $this->validateItemType($value); @@ -113,12 +114,12 @@ public function offsetSet($offset, $value) } } - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->items[$offset]); } - public function count() + public function count(): int { return count($this->items); } @@ -146,7 +147,7 @@ public static function fromJson($geoJson) * * @return \GeoJson\Geometry\GeometryCollection */ - public function jsonSerialize() + public function jsonSerialize(): mixed { $geometries = []; foreach ($this->items as $geometry) { diff --git a/src/Types/LineString.php b/src/Types/LineString.php index 1cc4a410..09017149 100644 --- a/src/Types/LineString.php +++ b/src/Types/LineString.php @@ -65,7 +65,7 @@ public static function fromJson($geoJson) * * @return \GeoJson\Geometry\LineString */ - public function jsonSerialize() + public function jsonSerialize(): mixed { $points = []; foreach ($this->items as $point) { diff --git a/src/Types/MultiLineString.php b/src/Types/MultiLineString.php index 62c4d576..02debf41 100644 --- a/src/Types/MultiLineString.php +++ b/src/Types/MultiLineString.php @@ -49,7 +49,7 @@ public function __toString() }, $this->getLineStrings())); } - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { $this->validateItemType($value); @@ -83,7 +83,7 @@ public static function fromJson($geoJson) * * @return \GeoJson\Geometry\MultiLineString */ - public function jsonSerialize() + public function jsonSerialize(): mixed { $lineStrings = []; diff --git a/src/Types/MultiPoint.php b/src/Types/MultiPoint.php index 752967eb..eb98cfd8 100644 --- a/src/Types/MultiPoint.php +++ b/src/Types/MultiPoint.php @@ -69,7 +69,7 @@ public static function fromJson($geoJson) * * @return \GeoJson\Geometry\MultiPoint */ - public function jsonSerialize() + public function jsonSerialize(): mixed { $points = []; foreach ($this->items as $point) { diff --git a/src/Types/MultiPolygon.php b/src/Types/MultiPolygon.php index cdea3a9c..4f317635 100644 --- a/src/Types/MultiPolygon.php +++ b/src/Types/MultiPolygon.php @@ -89,7 +89,7 @@ protected static function assembleParts(array $parts) return $polygons; } - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { $this->validateItemType($value); @@ -127,7 +127,7 @@ public static function fromJson($geoJson) * * @return \GeoJson\Geometry\MultiPolygon */ - public function jsonSerialize() + public function jsonSerialize(): mixed { $polygons = []; foreach ($this->items as $polygon) { diff --git a/src/Types/Point.php b/src/Types/Point.php index d424ec5e..860d25e8 100644 --- a/src/Types/Point.php +++ b/src/Types/Point.php @@ -92,7 +92,7 @@ public static function fromJson($geoJson) * * @return \GeoJson\Geometry\Point */ - public function jsonSerialize() + public function jsonSerialize(): mixed { return new GeoJsonPoint([$this->getLng(), $this->getLat()]); } diff --git a/src/Types/PointCollection.php b/src/Types/PointCollection.php index 30d1b8de..862e80aa 100755 --- a/src/Types/PointCollection.php +++ b/src/Types/PointCollection.php @@ -21,7 +21,7 @@ public function toPairList() }, $this->items)); } - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { $this->validateItemType($value); diff --git a/src/Types/Polygon.php b/src/Types/Polygon.php index 9c10cecc..acd6da10 100644 --- a/src/Types/Polygon.php +++ b/src/Types/Polygon.php @@ -40,7 +40,7 @@ public static function fromJson($geoJson) * * @return \GeoJson\Geometry\Polygon */ - public function jsonSerialize() + public function jsonSerialize(): mixed { $linearRings = []; foreach ($this->items as $lineString) {