Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added return type
  • Loading branch information
tdomy committed Jul 16, 2022
commit 50cc71cd49dc5a721cb9b444754c4bf9c9fc4ce3
4 changes: 2 additions & 2 deletions src/Geometries/GeometryCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function ($geometry_string) {
);
}

public function count()
public function count(): int
{
return count($this->geometries);
}
Expand All @@ -79,7 +79,7 @@ public function count()
*
* @return \GeoJson\Geometry\GeometryCollection
*/
public function jsonSerialize()
public function jsonSerialize(): \GeoJson\Geometry\GeometryCollection
{
$geometries = [];
foreach ($this->geometries as $geometry) {
Expand Down
2 changes: 1 addition & 1 deletion src/Geometries/LineString.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __toString()
*
* @return \GeoJson\Geometry\LineString
*/
public function jsonSerialize()
public function jsonSerialize(): \GeoJson\Geometry\LineString
{
$points = [];
foreach ($this->points as $point) {
Expand Down
2 changes: 1 addition & 1 deletion src/Geometries/MultiLineString.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __toString()
}, $this->getLineStrings()));
}

public function count()
public function count(): int
{
return count($this->linestrings);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Geometries/MultiPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __toString()
*
* @return \GeoJson\Geometry\MultiPoint
*/
public function jsonSerialize()
public function jsonSerialize(): \GeoJson\Geometry\MultiPoint
{
$points = [];
foreach ($this->points as $point) {
Expand Down
4 changes: 2 additions & 2 deletions src/Geometries/MultiPolygon.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function fromString($wktArgument)
* <p>
* The return value is cast to an integer.
*/
public function count()
public function count(): int
{
return count($this->polygons);
}
Expand Down Expand Up @@ -121,7 +121,7 @@ protected static function assembleParts(array $parts)
*
* @return \GeoJson\Geometry\MultiPolygon
*/
public function jsonSerialize()
public function jsonSerialize(): \GeoJson\Geometry\MultiPolygon
{
$polygons = [];
foreach ($this->polygons as $polygon) {
Expand Down
2 changes: 1 addition & 1 deletion src/Geometries/Point.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function __toString()
*
* @return \GeoJson\Geometry\Point
*/
public function jsonSerialize()
public function jsonSerialize(): \GeoJson\Geometry\Point
{
$position = [$this->getLng(), $this->getLat()];
if ($this->is3d()) $position[] = $this->getAlt();
Expand Down
13 changes: 7 additions & 6 deletions src/Geometries/PointCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use InvalidArgumentException;
use IteratorAggregate;
use JsonSerializable;
use Traversable;

abstract class PointCollection implements IteratorAggregate, Arrayable, ArrayAccess, Countable, JsonSerializable
{
Expand Down Expand Up @@ -46,7 +47,7 @@ public function toArray()
return $this->points;
}

public function getIterator()
public function getIterator(): Traversable
{
return new ArrayIterator($this->points);
}
Expand All @@ -70,7 +71,7 @@ public function insertPoint($index, Point $point)
array_splice($this->points, $offset, 0, [$point]);
}

public function offsetExists($offset)
public function offsetExists($offset): bool
{
return isset($this->points[$offset]);
}
Expand All @@ -79,12 +80,12 @@ public function offsetExists($offset)
* @param mixed $offset
* @return null|Point
*/
public function offsetGet($offset)
public function offsetGet($offset): ?Point
{
return $this->offsetExists($offset) ? $this->points[$offset] : null;
}

public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
if (!($value instanceof Point)) {
throw new InvalidArgumentException('$value must be an instance of Point');
Expand All @@ -97,12 +98,12 @@ public function offsetSet($offset, $value)
}
}

public function offsetUnset($offset)
public function offsetUnset($offset): void
{
unset($this->points[$offset]);
}

public function count()
public function count(): int
{
return count($this->points);
}
Expand Down