From 8a0c5a88098bc70d05a4cb491ed77303ce9ff075 Mon Sep 17 00:00:00 2001 From: Simon Schaufelberger Date: Mon, 11 Apr 2022 01:56:18 +0200 Subject: [PATCH] Use psr-4 autoloading and sort imports alphabetically (#38) --- composer.json | 9 ++++++++- phpcs.xml.dist | 1 + phpunit.xml.dist | 4 ++-- src/{GeoJson => }/BoundingBox.php | 4 ++-- .../CoordinateReferenceSystem.php | 0 src/{GeoJson => }/CoordinateReferenceSystem/Linked.php | 0 src/{GeoJson => }/CoordinateReferenceSystem/Named.php | 0 src/{GeoJson => }/Exception/Exception.php | 0 src/{GeoJson => }/Exception/UnserializationException.php | 6 +++--- src/{GeoJson => }/Feature/Feature.php | 0 src/{GeoJson => }/Feature/FeatureCollection.php | 4 ++-- src/{GeoJson => }/GeoJson.php | 2 +- src/{GeoJson => }/Geometry/Geometry.php | 0 src/{GeoJson => }/Geometry/GeometryCollection.php | 4 ++-- src/{GeoJson => }/Geometry/LineString.php | 0 src/{GeoJson => }/Geometry/LinearRing.php | 0 src/{GeoJson => }/Geometry/MultiLineString.php | 0 src/{GeoJson => }/Geometry/MultiPoint.php | 0 src/{GeoJson => }/Geometry/MultiPolygon.php | 0 src/{GeoJson => }/Geometry/Point.php | 2 +- src/{GeoJson => }/Geometry/Polygon.php | 0 src/{GeoJson => }/JsonUnserializable.php | 0 tests/{GeoJson/Tests => }/BaseGeoJsonTest.php | 0 tests/{GeoJson/Tests => }/BoundingBoxTest.php | 0 .../CoordinateReferenceSystemTest.php | 0 .../Tests => }/CoordinateReferenceSystem/LinkedTest.php | 0 .../Tests => }/CoordinateReferenceSystem/NamedTest.php | 0 .../Tests => }/Feature/FeatureCollectionTest.php | 0 tests/{GeoJson/Tests => }/Feature/FeatureTest.php | 0 tests/{GeoJson/Tests => }/GeoJsonTest.php | 4 ++-- .../Tests => }/Geometry/GeometryCollectionTest.php | 0 tests/{GeoJson/Tests => }/Geometry/GeometryTest.php | 0 tests/{GeoJson/Tests => }/Geometry/LineStringTest.php | 0 tests/{GeoJson/Tests => }/Geometry/LinearRingTest.php | 0 .../{GeoJson/Tests => }/Geometry/MultiLineStringTest.php | 0 tests/{GeoJson/Tests => }/Geometry/MultiPointTest.php | 0 tests/{GeoJson/Tests => }/Geometry/MultiPolygonTest.php | 0 tests/{GeoJson/Tests => }/Geometry/PointTest.php | 2 +- tests/{GeoJson/Tests => }/Geometry/PolygonTest.php | 0 tests/bootstrap.php | 0 40 files changed, 25 insertions(+), 17 deletions(-) rename src/{GeoJson => }/BoundingBox.php (100%) rename src/{GeoJson => }/CoordinateReferenceSystem/CoordinateReferenceSystem.php (100%) rename src/{GeoJson => }/CoordinateReferenceSystem/Linked.php (100%) rename src/{GeoJson => }/CoordinateReferenceSystem/Named.php (100%) rename src/{GeoJson => }/Exception/Exception.php (100%) rename src/{GeoJson => }/Exception/UnserializationException.php (100%) rename src/{GeoJson => }/Feature/Feature.php (100%) rename src/{GeoJson => }/Feature/FeatureCollection.php (100%) rename src/{GeoJson => }/GeoJson.php (100%) rename src/{GeoJson => }/Geometry/Geometry.php (100%) rename src/{GeoJson => }/Geometry/GeometryCollection.php (100%) rename src/{GeoJson => }/Geometry/LineString.php (100%) rename src/{GeoJson => }/Geometry/LinearRing.php (100%) rename src/{GeoJson => }/Geometry/MultiLineString.php (100%) rename src/{GeoJson => }/Geometry/MultiPoint.php (100%) rename src/{GeoJson => }/Geometry/MultiPolygon.php (100%) rename src/{GeoJson => }/Geometry/Point.php (100%) rename src/{GeoJson => }/Geometry/Polygon.php (100%) rename src/{GeoJson => }/JsonUnserializable.php (100%) rename tests/{GeoJson/Tests => }/BaseGeoJsonTest.php (100%) rename tests/{GeoJson/Tests => }/BoundingBoxTest.php (100%) rename tests/{GeoJson/Tests => }/CoordinateReferenceSystem/CoordinateReferenceSystemTest.php (100%) rename tests/{GeoJson/Tests => }/CoordinateReferenceSystem/LinkedTest.php (100%) rename tests/{GeoJson/Tests => }/CoordinateReferenceSystem/NamedTest.php (100%) rename tests/{GeoJson/Tests => }/Feature/FeatureCollectionTest.php (100%) rename tests/{GeoJson/Tests => }/Feature/FeatureTest.php (100%) rename tests/{GeoJson/Tests => }/GeoJsonTest.php (100%) rename tests/{GeoJson/Tests => }/Geometry/GeometryCollectionTest.php (100%) rename tests/{GeoJson/Tests => }/Geometry/GeometryTest.php (100%) rename tests/{GeoJson/Tests => }/Geometry/LineStringTest.php (100%) rename tests/{GeoJson/Tests => }/Geometry/LinearRingTest.php (100%) rename tests/{GeoJson/Tests => }/Geometry/MultiLineStringTest.php (100%) rename tests/{GeoJson/Tests => }/Geometry/MultiPointTest.php (100%) rename tests/{GeoJson/Tests => }/Geometry/MultiPolygonTest.php (100%) rename tests/{GeoJson/Tests => }/Geometry/PointTest.php (100%) rename tests/{GeoJson/Tests => }/Geometry/PolygonTest.php (100%) delete mode 100644 tests/bootstrap.php diff --git a/composer.json b/composer.json index adabadb..bfd5021 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,14 @@ "slevomat/coding-standard": "^7.0" }, "autoload": { - "psr-0": { "GeoJson\\": "src/" } + "psr-4": { + "GeoJson\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "GeoJson\\Tests\\": "tests" + } }, "extra": { "branch-alias": { diff --git a/phpcs.xml.dist b/phpcs.xml.dist index fac5711..f32015f 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -88,6 +88,7 @@ + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a302663..0f506df 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,13 +7,13 @@ > - ./tests/GeoJson/ + ./tests/ - ./src/GeoJson + ./src/ diff --git a/src/GeoJson/BoundingBox.php b/src/BoundingBox.php similarity index 100% rename from src/GeoJson/BoundingBox.php rename to src/BoundingBox.php index c43a6cf..cf9eda9 100644 --- a/src/GeoJson/BoundingBox.php +++ b/src/BoundingBox.php @@ -9,9 +9,9 @@ use JsonSerializable; use function count; -use function is_int; -use function is_float; use function is_array; +use function is_float; +use function is_int; /** * BoundingBox object. diff --git a/src/GeoJson/CoordinateReferenceSystem/CoordinateReferenceSystem.php b/src/CoordinateReferenceSystem/CoordinateReferenceSystem.php similarity index 100% rename from src/GeoJson/CoordinateReferenceSystem/CoordinateReferenceSystem.php rename to src/CoordinateReferenceSystem/CoordinateReferenceSystem.php diff --git a/src/GeoJson/CoordinateReferenceSystem/Linked.php b/src/CoordinateReferenceSystem/Linked.php similarity index 100% rename from src/GeoJson/CoordinateReferenceSystem/Linked.php rename to src/CoordinateReferenceSystem/Linked.php diff --git a/src/GeoJson/CoordinateReferenceSystem/Named.php b/src/CoordinateReferenceSystem/Named.php similarity index 100% rename from src/GeoJson/CoordinateReferenceSystem/Named.php rename to src/CoordinateReferenceSystem/Named.php diff --git a/src/GeoJson/Exception/Exception.php b/src/Exception/Exception.php similarity index 100% rename from src/GeoJson/Exception/Exception.php rename to src/Exception/Exception.php diff --git a/src/GeoJson/Exception/UnserializationException.php b/src/Exception/UnserializationException.php similarity index 100% rename from src/GeoJson/Exception/UnserializationException.php rename to src/Exception/UnserializationException.php index 82580e4..7b9607a 100644 --- a/src/GeoJson/Exception/UnserializationException.php +++ b/src/Exception/UnserializationException.php @@ -6,11 +6,11 @@ use RuntimeException; -use function sprintf; -use function is_object; use function get_class; -use function gettype; use function get_debug_type; +use function gettype; +use function is_object; +use function sprintf; class UnserializationException extends RuntimeException implements Exception { diff --git a/src/GeoJson/Feature/Feature.php b/src/Feature/Feature.php similarity index 100% rename from src/GeoJson/Feature/Feature.php rename to src/Feature/Feature.php diff --git a/src/GeoJson/Feature/FeatureCollection.php b/src/Feature/FeatureCollection.php similarity index 100% rename from src/GeoJson/Feature/FeatureCollection.php rename to src/Feature/FeatureCollection.php index 0b4143b..497762b 100644 --- a/src/GeoJson/Feature/FeatureCollection.php +++ b/src/Feature/FeatureCollection.php @@ -13,10 +13,10 @@ use IteratorAggregate; use Traversable; +use function array_map; +use function array_merge; use function array_values; use function count; -use function array_merge; -use function array_map; /** * Collection of Feature objects. diff --git a/src/GeoJson/GeoJson.php b/src/GeoJson.php similarity index 100% rename from src/GeoJson/GeoJson.php rename to src/GeoJson.php index 576019d..60210a3 100644 --- a/src/GeoJson/GeoJson.php +++ b/src/GeoJson.php @@ -9,9 +9,9 @@ use GeoJson\Exception\UnserializationException; use JsonSerializable; +use function array_map; use function is_array; use function is_object; -use function array_map; use function sprintf; use function strncmp; diff --git a/src/GeoJson/Geometry/Geometry.php b/src/Geometry/Geometry.php similarity index 100% rename from src/GeoJson/Geometry/Geometry.php rename to src/Geometry/Geometry.php diff --git a/src/GeoJson/Geometry/GeometryCollection.php b/src/Geometry/GeometryCollection.php similarity index 100% rename from src/GeoJson/Geometry/GeometryCollection.php rename to src/Geometry/GeometryCollection.php index 734f8cc..29ae695 100644 --- a/src/GeoJson/Geometry/GeometryCollection.php +++ b/src/Geometry/GeometryCollection.php @@ -12,10 +12,10 @@ use IteratorAggregate; use Traversable; +use function array_map; +use function array_merge; use function array_values; use function count; -use function array_merge; -use function array_map; /** * Collection of Geometry objects. diff --git a/src/GeoJson/Geometry/LineString.php b/src/Geometry/LineString.php similarity index 100% rename from src/GeoJson/Geometry/LineString.php rename to src/Geometry/LineString.php diff --git a/src/GeoJson/Geometry/LinearRing.php b/src/Geometry/LinearRing.php similarity index 100% rename from src/GeoJson/Geometry/LinearRing.php rename to src/Geometry/LinearRing.php diff --git a/src/GeoJson/Geometry/MultiLineString.php b/src/Geometry/MultiLineString.php similarity index 100% rename from src/GeoJson/Geometry/MultiLineString.php rename to src/Geometry/MultiLineString.php diff --git a/src/GeoJson/Geometry/MultiPoint.php b/src/Geometry/MultiPoint.php similarity index 100% rename from src/GeoJson/Geometry/MultiPoint.php rename to src/Geometry/MultiPoint.php diff --git a/src/GeoJson/Geometry/MultiPolygon.php b/src/Geometry/MultiPolygon.php similarity index 100% rename from src/GeoJson/Geometry/MultiPolygon.php rename to src/Geometry/MultiPolygon.php diff --git a/src/GeoJson/Geometry/Point.php b/src/Geometry/Point.php similarity index 100% rename from src/GeoJson/Geometry/Point.php rename to src/Geometry/Point.php index b32d897..cab3699 100644 --- a/src/GeoJson/Geometry/Point.php +++ b/src/Geometry/Point.php @@ -9,8 +9,8 @@ use InvalidArgumentException; use function count; -use function is_int; use function is_float; +use function is_int; /** * Point geometry object. diff --git a/src/GeoJson/Geometry/Polygon.php b/src/Geometry/Polygon.php similarity index 100% rename from src/GeoJson/Geometry/Polygon.php rename to src/Geometry/Polygon.php diff --git a/src/GeoJson/JsonUnserializable.php b/src/JsonUnserializable.php similarity index 100% rename from src/GeoJson/JsonUnserializable.php rename to src/JsonUnserializable.php diff --git a/tests/GeoJson/Tests/BaseGeoJsonTest.php b/tests/BaseGeoJsonTest.php similarity index 100% rename from tests/GeoJson/Tests/BaseGeoJsonTest.php rename to tests/BaseGeoJsonTest.php diff --git a/tests/GeoJson/Tests/BoundingBoxTest.php b/tests/BoundingBoxTest.php similarity index 100% rename from tests/GeoJson/Tests/BoundingBoxTest.php rename to tests/BoundingBoxTest.php diff --git a/tests/GeoJson/Tests/CoordinateReferenceSystem/CoordinateReferenceSystemTest.php b/tests/CoordinateReferenceSystem/CoordinateReferenceSystemTest.php similarity index 100% rename from tests/GeoJson/Tests/CoordinateReferenceSystem/CoordinateReferenceSystemTest.php rename to tests/CoordinateReferenceSystem/CoordinateReferenceSystemTest.php diff --git a/tests/GeoJson/Tests/CoordinateReferenceSystem/LinkedTest.php b/tests/CoordinateReferenceSystem/LinkedTest.php similarity index 100% rename from tests/GeoJson/Tests/CoordinateReferenceSystem/LinkedTest.php rename to tests/CoordinateReferenceSystem/LinkedTest.php diff --git a/tests/GeoJson/Tests/CoordinateReferenceSystem/NamedTest.php b/tests/CoordinateReferenceSystem/NamedTest.php similarity index 100% rename from tests/GeoJson/Tests/CoordinateReferenceSystem/NamedTest.php rename to tests/CoordinateReferenceSystem/NamedTest.php diff --git a/tests/GeoJson/Tests/Feature/FeatureCollectionTest.php b/tests/Feature/FeatureCollectionTest.php similarity index 100% rename from tests/GeoJson/Tests/Feature/FeatureCollectionTest.php rename to tests/Feature/FeatureCollectionTest.php diff --git a/tests/GeoJson/Tests/Feature/FeatureTest.php b/tests/Feature/FeatureTest.php similarity index 100% rename from tests/GeoJson/Tests/Feature/FeatureTest.php rename to tests/Feature/FeatureTest.php diff --git a/tests/GeoJson/Tests/GeoJsonTest.php b/tests/GeoJsonTest.php similarity index 100% rename from tests/GeoJson/Tests/GeoJsonTest.php rename to tests/GeoJsonTest.php index 8d68f83..c4496e7 100644 --- a/tests/GeoJson/Tests/GeoJsonTest.php +++ b/tests/GeoJsonTest.php @@ -13,10 +13,10 @@ use JsonSerializable; use PHPUnit\Framework\TestCase; -use function json_decode; -use function is_object; use function get_class; use function gettype; +use function is_object; +use function json_decode; class GeoJsonTest extends TestCase { diff --git a/tests/GeoJson/Tests/Geometry/GeometryCollectionTest.php b/tests/Geometry/GeometryCollectionTest.php similarity index 100% rename from tests/GeoJson/Tests/Geometry/GeometryCollectionTest.php rename to tests/Geometry/GeometryCollectionTest.php diff --git a/tests/GeoJson/Tests/Geometry/GeometryTest.php b/tests/Geometry/GeometryTest.php similarity index 100% rename from tests/GeoJson/Tests/Geometry/GeometryTest.php rename to tests/Geometry/GeometryTest.php diff --git a/tests/GeoJson/Tests/Geometry/LineStringTest.php b/tests/Geometry/LineStringTest.php similarity index 100% rename from tests/GeoJson/Tests/Geometry/LineStringTest.php rename to tests/Geometry/LineStringTest.php diff --git a/tests/GeoJson/Tests/Geometry/LinearRingTest.php b/tests/Geometry/LinearRingTest.php similarity index 100% rename from tests/GeoJson/Tests/Geometry/LinearRingTest.php rename to tests/Geometry/LinearRingTest.php diff --git a/tests/GeoJson/Tests/Geometry/MultiLineStringTest.php b/tests/Geometry/MultiLineStringTest.php similarity index 100% rename from tests/GeoJson/Tests/Geometry/MultiLineStringTest.php rename to tests/Geometry/MultiLineStringTest.php diff --git a/tests/GeoJson/Tests/Geometry/MultiPointTest.php b/tests/Geometry/MultiPointTest.php similarity index 100% rename from tests/GeoJson/Tests/Geometry/MultiPointTest.php rename to tests/Geometry/MultiPointTest.php diff --git a/tests/GeoJson/Tests/Geometry/MultiPolygonTest.php b/tests/Geometry/MultiPolygonTest.php similarity index 100% rename from tests/GeoJson/Tests/Geometry/MultiPolygonTest.php rename to tests/Geometry/MultiPolygonTest.php diff --git a/tests/GeoJson/Tests/Geometry/PointTest.php b/tests/Geometry/PointTest.php similarity index 100% rename from tests/GeoJson/Tests/Geometry/PointTest.php rename to tests/Geometry/PointTest.php index d474918..28baed9 100644 --- a/tests/GeoJson/Tests/Geometry/PointTest.php +++ b/tests/Geometry/PointTest.php @@ -11,8 +11,8 @@ use InvalidArgumentException; use stdClass; -use function is_subclass_of; use function func_get_args; +use function is_subclass_of; use function json_decode; class PointTest extends BaseGeoJsonTest diff --git a/tests/GeoJson/Tests/Geometry/PolygonTest.php b/tests/Geometry/PolygonTest.php similarity index 100% rename from tests/GeoJson/Tests/Geometry/PolygonTest.php rename to tests/Geometry/PolygonTest.php diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index e69de29..0000000