diff --git a/src/Shapefile/Geometry/GeometryCollection.php b/src/Shapefile/Geometry/GeometryCollection.php index 2eb23e6..3bac9d3 100644 --- a/src/Shapefile/Geometry/GeometryCollection.php +++ b/src/Shapefile/Geometry/GeometryCollection.php @@ -45,7 +45,7 @@ abstract protected function getCollectionClass(); * * @param \Shapefile\Geometry\Geometry[] $geometries Optional array of geometries to initialize the collection. */ - public function __construct(array $geometries = null) + public function __construct(array $geometries = []) { if ($geometries !== null) { foreach ($geometries as $Geometry) { diff --git a/src/Shapefile/Geometry/MultiPolygon.php b/src/Shapefile/Geometry/MultiPolygon.php index f217cf7..dddd747 100644 --- a/src/Shapefile/Geometry/MultiPolygon.php +++ b/src/Shapefile/Geometry/MultiPolygon.php @@ -91,7 +91,7 @@ class MultiPolygon extends GeometryCollection * - Shapefile::ORIENTATION_COUNTERCLOCKWISE * - Shapefile::ORIENTATION_UNCHANGED */ - public function __construct(array $polygons = null, $closed_rings = Shapefile::ACTION_CHECK, $force_orientation = Shapefile::ORIENTATION_COUNTERCLOCKWISE) + public function __construct(array $polygons = [], $closed_rings = Shapefile::ACTION_CHECK, $force_orientation = Shapefile::ORIENTATION_COUNTERCLOCKWISE) { $this->closed_rings = $closed_rings; $this->force_orientation = $force_orientation; @@ -109,7 +109,7 @@ public function initFromArray($array) if (!isset($part['rings']) || !is_array($part['rings'])) { throw new ShapefileException(Shapefile::ERR_INPUT_ARRAY_NOT_VALID); } - $Polygon = new Polygon(null, $this->closed_rings, $this->force_orientation); + $Polygon = new Polygon([], $this->closed_rings, $this->force_orientation); foreach ($part['rings'] as $part) { if (!isset($part['points']) || !is_array($part['points'])) { throw new ShapefileException(Shapefile::ERR_INPUT_ARRAY_NOT_VALID); @@ -135,7 +135,7 @@ public function initFromWKT($wkt) $force_z = $this->wktIsZ($wkt); $force_m = $this->wktIsM($wkt); foreach (explode(')),((', substr($this->wktExtractData($wkt), 2, -2)) as $part) { - $Polygon = new Polygon(null, $this->closed_rings, $this->force_orientation); + $Polygon = new Polygon([], $this->closed_rings, $this->force_orientation); foreach (explode('),(', $part) as $ring) { $Linestring = new Linestring(); foreach (explode(',', $ring) as $wkt_coordinates) { @@ -160,7 +160,7 @@ public function initFromGeoJSON($geojson) if (!is_array($part)) { throw new ShapefileException(Shapefile::ERR_INPUT_GEOJSON_NOT_VALID, 'Wrong coordinates format'); } - $Polygon = new Polygon(null, $this->closed_rings, $this->force_orientation); + $Polygon = new Polygon([], $this->closed_rings, $this->force_orientation); foreach ($part as $ring) { if (!is_array($ring)) { throw new ShapefileException(Shapefile::ERR_INPUT_GEOJSON_NOT_VALID, 'Wrong coordinates format'); diff --git a/src/Shapefile/Geometry/Polygon.php b/src/Shapefile/Geometry/Polygon.php index ce9d831..d499628 100644 --- a/src/Shapefile/Geometry/Polygon.php +++ b/src/Shapefile/Geometry/Polygon.php @@ -84,7 +84,7 @@ class Polygon extends MultiLinestring * - Shapefile::ORIENTATION_COUNTERCLOCKWISE * - Shapefile::ORIENTATION_UNCHANGED */ - public function __construct(array $linestrings = null, $closed_rings = Shapefile::ACTION_CHECK, $force_orientation = Shapefile::ORIENTATION_COUNTERCLOCKWISE) + public function __construct(array $linestrings = [], $closed_rings = Shapefile::ACTION_CHECK, $force_orientation = Shapefile::ORIENTATION_COUNTERCLOCKWISE) { $this->closed_rings = $closed_rings; $this->force_orientation = $force_orientation; diff --git a/src/Shapefile/ShapefileReader.php b/src/Shapefile/ShapefileReader.php index f4c41da..58062b1 100644 --- a/src/Shapefile/ShapefileReader.php +++ b/src/Shapefile/ShapefileReader.php @@ -974,7 +974,7 @@ private function readPolygonZ() */ private function createPolygon($data) { - $MultiPolygon = new MultiPolygon(null, $this->getOption(Shapefile::OPTION_POLYGON_CLOSED_RINGS_ACTION), $this->getOption(Shapefile::OPTION_POLYGON_OUTPUT_ORIENTATION)); + $MultiPolygon = new MultiPolygon([], $this->getOption(Shapefile::OPTION_POLYGON_CLOSED_RINGS_ACTION), $this->getOption(Shapefile::OPTION_POLYGON_OUTPUT_ORIENTATION)); $Polygon = null; $temp_state = null; foreach ($data['geometry']['parts'] as $part) { @@ -988,7 +988,7 @@ private function createPolygon($data) if ($Polygon !== null) { $MultiPolygon->addPolygon($Polygon); } - $Polygon = new Polygon(null, $this->getOption(Shapefile::OPTION_POLYGON_CLOSED_RINGS_ACTION), $this->getOption(Shapefile::OPTION_POLYGON_OUTPUT_ORIENTATION)); + $Polygon = new Polygon([], $this->getOption(Shapefile::OPTION_POLYGON_CLOSED_RINGS_ACTION), $this->getOption(Shapefile::OPTION_POLYGON_OUTPUT_ORIENTATION)); $temp_state = $is_clockwise; } $Polygon->addRing($Linestring);