From 4ec5a4cc6f202239a8c4fef9e86f6042d438543a Mon Sep 17 00:00:00 2001 From: Matan Yadaev Date: Wed, 24 Jul 2024 19:15:56 +0300 Subject: [PATCH] fixes --- phpstan.neon | 3 ++- src/GeometryExpression.php | 4 +--- tests/HasSpatialTest.php | 6 +++--- tests/Objects/GeometryCollectionTest.php | 1 - tests/Objects/LineStringTest.php | 1 - tests/Objects/MultiLineStringTest.php | 1 - tests/Objects/MultiPointTest.php | 1 - tests/Objects/MultiPolygonTest.php | 1 - tests/Objects/PointTest.php | 1 - tests/Objects/PolygonTest.php | 1 - tests/TestObjects/ExtendedGeometryCollection.php | 4 +--- tests/TestObjects/ExtendedLineString.php | 4 +--- tests/TestObjects/ExtendedMultiLineString.php | 4 +--- tests/TestObjects/ExtendedMultiPoint.php | 4 +--- tests/TestObjects/ExtendedMultiPolygon.php | 4 +--- tests/TestObjects/ExtendedPoint.php | 4 +--- tests/TestObjects/ExtendedPolygon.php | 4 +--- 17 files changed, 13 insertions(+), 35 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index d1db335..a0d0397 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -18,7 +18,8 @@ parameters: - message: '#Call to an undefined method Pest\\Expectation\<.+\>\:\:toBe(InstanceOf)?On(Postgres|Mysql)\(\)#' path: tests/*.php + - + identifier: missingType.generics level: max checkMissingIterableValueType: true - checkGenericClassInNonGenericObjectType: false diff --git a/src/GeometryExpression.php b/src/GeometryExpression.php index 2b4fed7..fbf2607 100644 --- a/src/GeometryExpression.php +++ b/src/GeometryExpression.php @@ -10,9 +10,7 @@ /** @codeCoverageIgnore */ class GeometryExpression { - public function __construct(readonly private string $expression) - { - } + public function __construct(readonly private string $expression) {} public function normalize(ConnectionInterface $connection): string { diff --git a/tests/HasSpatialTest.php b/tests/HasSpatialTest.php index 1a967a2..a949ae2 100644 --- a/tests/HasSpatialTest.php +++ b/tests/HasSpatialTest.php @@ -447,7 +447,7 @@ }); it('toExpressionString can handle a Expression input', function (): void { - $spatialBuilder = new TestPlace(); + $spatialBuilder = new TestPlace; $toExpressionStringMethod = (new ReflectionClass($spatialBuilder))->getMethod('toExpressionString'); $result = $toExpressionStringMethod->invoke($spatialBuilder, DB::raw('POINT(longitude, latitude)')); @@ -456,7 +456,7 @@ }); it('toExpressionString can handle a Geometry input', function (): void { - $testPlace = new TestPlace(); + $testPlace = new TestPlace; $toExpressionStringMethod = (new ReflectionClass($testPlace))->getMethod('toExpressionString'); $polygon = Polygon::fromJson('{"type":"Polygon","coordinates":[[[-1,-1],[1,-1],[1,1],[-1,1],[-1,-1]]]}'); @@ -469,7 +469,7 @@ }); it('toExpressionString can handle a string input', function (): void { - $spatialBuilder = new TestPlace(); + $spatialBuilder = new TestPlace; $toExpressionStringMethod = (new ReflectionClass($spatialBuilder))->getMethod('toExpressionString'); $result = $toExpressionStringMethod->invoke($spatialBuilder, 'test_places.point'); diff --git a/tests/Objects/GeometryCollectionTest.php b/tests/Objects/GeometryCollectionTest.php index 5c579db..29bc435 100644 --- a/tests/Objects/GeometryCollectionTest.php +++ b/tests/Objects/GeometryCollectionTest.php @@ -486,7 +486,6 @@ it('adds a macro toGeometryCollection', function (): void { Geometry::macro('getName', function (): string { /** @var Geometry $this */ - // @phpstan-ignore-next-line return class_basename($this); }); diff --git a/tests/Objects/LineStringTest.php b/tests/Objects/LineStringTest.php index 7a8959e..3a02b28 100644 --- a/tests/Objects/LineStringTest.php +++ b/tests/Objects/LineStringTest.php @@ -200,7 +200,6 @@ it('adds a macro toLineString', function (): void { Geometry::macro('getName', function (): string { /** @var Geometry $this */ - // @phpstan-ignore-next-line return class_basename($this); }); diff --git a/tests/Objects/MultiLineStringTest.php b/tests/Objects/MultiLineStringTest.php index 73bcde9..93f015a 100644 --- a/tests/Objects/MultiLineStringTest.php +++ b/tests/Objects/MultiLineStringTest.php @@ -228,7 +228,6 @@ it('adds a macro toMultiLineString', function (): void { Geometry::macro('getName', function (): string { /** @var Geometry $this */ - // @phpstan-ignore-next-line return class_basename($this); }); diff --git a/tests/Objects/MultiPointTest.php b/tests/Objects/MultiPointTest.php index 39667d6..95cfb63 100644 --- a/tests/Objects/MultiPointTest.php +++ b/tests/Objects/MultiPointTest.php @@ -183,7 +183,6 @@ it('adds a macro toMultiPoint', function (): void { Geometry::macro('getName', function (): string { /** @var Geometry $this */ - // @phpstan-ignore-next-line return class_basename($this); }); diff --git a/tests/Objects/MultiPolygonTest.php b/tests/Objects/MultiPolygonTest.php index ed9eea9..2f53aef 100644 --- a/tests/Objects/MultiPolygonTest.php +++ b/tests/Objects/MultiPolygonTest.php @@ -304,7 +304,6 @@ it('adds a macro toMultiPolygon', function (): void { Geometry::macro('getName', function (): string { /** @var Geometry $this */ - // @phpstan-ignore-next-line return class_basename($this); }); diff --git a/tests/Objects/PointTest.php b/tests/Objects/PointTest.php index d35645f..26f3934 100644 --- a/tests/Objects/PointTest.php +++ b/tests/Objects/PointTest.php @@ -133,7 +133,6 @@ it('adds a macro toPoint', function (): void { Geometry::macro('getName', function (): string { /** @var Geometry $this */ - // @phpstan-ignore-next-line return class_basename($this); }); diff --git a/tests/Objects/PolygonTest.php b/tests/Objects/PolygonTest.php index 316ee0f..e3c55d9 100644 --- a/tests/Objects/PolygonTest.php +++ b/tests/Objects/PolygonTest.php @@ -273,7 +273,6 @@ it('adds a macro toPolygon', function (): void { Geometry::macro('getName', function (): string { /** @var Geometry $this */ - // @phpstan-ignore-next-line return class_basename($this); }); diff --git a/tests/TestObjects/ExtendedGeometryCollection.php b/tests/TestObjects/ExtendedGeometryCollection.php index 87036a2..ddc5412 100644 --- a/tests/TestObjects/ExtendedGeometryCollection.php +++ b/tests/TestObjects/ExtendedGeometryCollection.php @@ -4,6 +4,4 @@ use MatanYadaev\EloquentSpatial\Objects\GeometryCollection; -class ExtendedGeometryCollection extends GeometryCollection -{ -} +class ExtendedGeometryCollection extends GeometryCollection {} diff --git a/tests/TestObjects/ExtendedLineString.php b/tests/TestObjects/ExtendedLineString.php index aaa946b..e4e1e43 100644 --- a/tests/TestObjects/ExtendedLineString.php +++ b/tests/TestObjects/ExtendedLineString.php @@ -4,6 +4,4 @@ use MatanYadaev\EloquentSpatial\Objects\LineString; -class ExtendedLineString extends LineString -{ -} +class ExtendedLineString extends LineString {} diff --git a/tests/TestObjects/ExtendedMultiLineString.php b/tests/TestObjects/ExtendedMultiLineString.php index a63f68e..82f1f9c 100644 --- a/tests/TestObjects/ExtendedMultiLineString.php +++ b/tests/TestObjects/ExtendedMultiLineString.php @@ -4,6 +4,4 @@ use MatanYadaev\EloquentSpatial\Objects\MultiLineString; -class ExtendedMultiLineString extends MultiLineString -{ -} +class ExtendedMultiLineString extends MultiLineString {} diff --git a/tests/TestObjects/ExtendedMultiPoint.php b/tests/TestObjects/ExtendedMultiPoint.php index 6ec5ca2..86914cf 100644 --- a/tests/TestObjects/ExtendedMultiPoint.php +++ b/tests/TestObjects/ExtendedMultiPoint.php @@ -4,6 +4,4 @@ use MatanYadaev\EloquentSpatial\Objects\MultiPoint; -class ExtendedMultiPoint extends MultiPoint -{ -} +class ExtendedMultiPoint extends MultiPoint {} diff --git a/tests/TestObjects/ExtendedMultiPolygon.php b/tests/TestObjects/ExtendedMultiPolygon.php index e729f07..9b32cad 100644 --- a/tests/TestObjects/ExtendedMultiPolygon.php +++ b/tests/TestObjects/ExtendedMultiPolygon.php @@ -4,6 +4,4 @@ use MatanYadaev\EloquentSpatial\Objects\MultiPolygon; -class ExtendedMultiPolygon extends MultiPolygon -{ -} +class ExtendedMultiPolygon extends MultiPolygon {} diff --git a/tests/TestObjects/ExtendedPoint.php b/tests/TestObjects/ExtendedPoint.php index d8aff43..7ad879d 100644 --- a/tests/TestObjects/ExtendedPoint.php +++ b/tests/TestObjects/ExtendedPoint.php @@ -4,6 +4,4 @@ use MatanYadaev\EloquentSpatial\Objects\Point; -class ExtendedPoint extends Point -{ -} +class ExtendedPoint extends Point {} diff --git a/tests/TestObjects/ExtendedPolygon.php b/tests/TestObjects/ExtendedPolygon.php index d148a20..f175e17 100644 --- a/tests/TestObjects/ExtendedPolygon.php +++ b/tests/TestObjects/ExtendedPolygon.php @@ -4,6 +4,4 @@ use MatanYadaev\EloquentSpatial\Objects\Polygon; -class ExtendedPolygon extends Polygon -{ -} +class ExtendedPolygon extends Polygon {}