Skip to content

Commit 09334bf

Browse files
committed
fixes
1 parent 655e18f commit 09334bf

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

src/Factory.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Collection as geoPHPGeometryCollection;
66
use Geometry as geoPHPGeometry;
77
use geoPHP;
8+
use Illuminate\Support\Collection;
89
use LineString as geoPHPLineString;
910
use MatanYadaev\EloquentSpatial\Objects\Geometry;
1011
use MatanYadaev\EloquentSpatial\Objects\GeometryCollection;
@@ -40,7 +41,7 @@ protected static function create(geoPHPGeometry $geometry): Geometry
4041
if ($geometry instanceof geoPHPGeometryCollection) {
4142
$components = collect($geometry->components)->map(function (geoPHPGeometry $geometryComponent): Geometry {
4243
return self::create($geometryComponent);
43-
})->all();
44+
});
4445

4546
$className = get_class($geometry);
4647

@@ -73,55 +74,55 @@ protected static function createPoint(float $latitude, float $longitude): Point
7374
}
7475

7576
/**
76-
* @param Point[] $points
77+
* @param Collection<Point> $points
7778
* @return MultiPoint
7879
*/
79-
protected static function createMultiPoint(array $points): MultiPoint
80+
protected static function createMultiPoint(Collection $points): MultiPoint
8081
{
8182
return new MultiPoint($points);
8283
}
8384

8485
/**
85-
* @param Point[] $points
86+
* @param Collection<Point> $points
8687
* @return LineString
8788
*/
88-
protected static function createLineString(array $points): LineString
89+
protected static function createLineString(Collection $points): LineString
8990
{
9091
return new LineString($points);
9192
}
9293

9394
/**
94-
* @param LineString[] $lineStrings
95+
* @param Collection<LineString> $lineStrings
9596
* @return Polygon
9697
*/
97-
protected static function createPolygon(array $lineStrings): Polygon
98+
protected static function createPolygon(Collection $lineStrings): Polygon
9899
{
99100
return new Polygon($lineStrings);
100101
}
101102

102103
/**
103-
* @param LineString[] $lineStrings
104+
* @param Collection<LineString> $lineStrings
104105
* @return MultiLineString
105106
*/
106-
protected static function createMultiLineString(array $lineStrings):MultiLineString
107+
protected static function createMultiLineString(Collection $lineStrings):MultiLineString
107108
{
108109
return new MultiLineString($lineStrings);
109110
}
110111

111112
/**
112-
* @param Polygon[] $polygons
113+
* @param Collection<Polygon> $polygons
113114
* @return MultiPolygon
114115
*/
115-
protected static function createMultiPolygon(array $polygons): MultiPolygon
116+
protected static function createMultiPolygon(Collection $polygons): MultiPolygon
116117
{
117118
return new MultiPolygon($polygons);
118119
}
119120

120121
/**
121-
* @param Geometry[] $geometries
122+
* @param Collection<Geometry> $geometries
122123
* @return GeometryCollection
123124
*/
124-
protected static function createGeometryCollection(array $geometries): GeometryCollection
125+
protected static function createGeometryCollection(Collection $geometries): GeometryCollection
125126
{
126127
return new GeometryCollection($geometries);
127128
}

src/Objects/MultiLineString.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/
1212
class MultiLineString extends GeometryCollection
1313
{
14+
/** @var Collection<LineString> */
15+
protected Collection $geometries;
16+
1417
protected string $collectionOf = LineString::class;
1518

1619
protected int $minimumGeometries = 1;

src/Objects/MultiPolygon.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
use InvalidArgumentException;
99

1010
/**
11-
* @method MultiPolygon[] getGeometries()
11+
* @method Polygon[] getGeometries()
1212
*/
1313
class MultiPolygon extends GeometryCollection
1414
{
15-
/** @var Collection<MultiPolygon> */
15+
/** @var Collection<Polygon> */
1616
protected Collection $geometries;
1717

1818
protected string $collectionOf = Polygon::class;

0 commit comments

Comments
 (0)