Skip to content

Commit a0c6526

Browse files
committed
Fix styling
1 parent 991d369 commit a0c6526

23 files changed

+72
-104
lines changed

src/Connectors/ConnectionFactory.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
class ConnectionFactory extends IlluminateConnectionFactory
1010
{
1111
/**
12-
* @param string $driver
13-
* @param \Closure|PDO $connection
14-
* @param string $database
15-
* @param string $prefix
16-
* @param array $config
17-
*
12+
* @param string $driver
13+
* @param \Closure|PDO $connection
14+
* @param string $database
15+
* @param string $prefix
1816
* @return \Illuminate\Database\ConnectionInterface
1917
*/
2018
protected function createConnection($driver, $connection, $database, $prefix = '', array $config = [])

src/Eloquent/SpatialTrait.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ trait SpatialTrait
6161
/**
6262
* Create a new Eloquent query builder for the model.
6363
*
64-
* @param \Illuminate\Database\Query\Builder $query
65-
*
64+
* @param \Illuminate\Database\Query\Builder $query
6665
* @return \Grimzy\LaravelMysqlSpatial\Eloquent\Builder
6766
*/
6867
public function newEloquentBuilder($query)
@@ -123,7 +122,7 @@ public function getSpatialFields()
123122

124123
public function isColumnAllowed($geometryColumn)
125124
{
126-
if (!in_array($geometryColumn, $this->getSpatialFields())) {
125+
if (! in_array($geometryColumn, $this->getSpatialFields())) {
127126
throw new SpatialFieldsNotDefinedException();
128127
}
129128

@@ -163,7 +162,7 @@ public function scopeDistanceValue($query, $geometryColumn, $geometry)
163162

164163
$columns = $query->getQuery()->columns;
165164

166-
if (!$columns) {
165+
if (! $columns) {
167166
$query->select('*');
168167
}
169168

@@ -206,7 +205,7 @@ public function scopeDistanceSphereValue($query, $geometryColumn, $geometry)
206205

207206
$columns = $query->getQuery()->columns;
208207

209-
if (!$columns) {
208+
if (! $columns) {
210209
$query->select('*');
211210
}
212211
$query->selectRaw("st_distance_sphere(`$geometryColumn`, ST_GeomFromText(?, ?, 'axis-order=long-lat')) as distance", [
@@ -219,7 +218,7 @@ public function scopeComparison($query, $geometryColumn, $geometry, $relationshi
219218
{
220219
$this->isColumnAllowed($geometryColumn);
221220

222-
if (!in_array($relationship, $this->stRelations)) {
221+
if (! in_array($relationship, $this->stRelations)) {
223222
throw new UnknownSpatialRelationFunction($relationship);
224223
}
225224

@@ -275,7 +274,7 @@ public function scopeOrderBySpatial($query, $geometryColumn, $geometry, $orderFu
275274
{
276275
$this->isColumnAllowed($geometryColumn);
277276

278-
if (!in_array($orderFunction, $this->stOrderFunctions)) {
277+
if (! in_array($orderFunction, $this->stOrderFunctions)) {
279278
throw new UnknownSpatialFunctionException($orderFunction);
280279
}
281280

src/Schema/Blueprint.php

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ class Blueprint extends IlluminateBlueprint
99
/**
1010
* Add a geometry column on the table.
1111
*
12-
* @param string $column
13-
* @param null|int $srid
14-
*
12+
* @param string $column
13+
* @param null|int $srid
1514
* @return \Illuminate\Support\Fluent
1615
*/
1716
public function geometry($column, $srid = null)
@@ -22,9 +21,8 @@ public function geometry($column, $srid = null)
2221
/**
2322
* Add a point column on the table.
2423
*
25-
* @param string $column
26-
* @param null|int $srid
27-
*
24+
* @param string $column
25+
* @param null|int $srid
2826
* @return \Illuminate\Support\Fluent
2927
*/
3028
public function point($column, $srid = null)
@@ -35,9 +33,8 @@ public function point($column, $srid = null)
3533
/**
3634
* Add a linestring column on the table.
3735
*
38-
* @param string $column
39-
* @param null|int $srid
40-
*
36+
* @param string $column
37+
* @param null|int $srid
4138
* @return \Illuminate\Support\Fluent
4239
*/
4340
public function lineString($column, $srid = null)
@@ -48,9 +45,8 @@ public function lineString($column, $srid = null)
4845
/**
4946
* Add a polygon column on the table.
5047
*
51-
* @param string $column
52-
* @param null|int $srid
53-
*
48+
* @param string $column
49+
* @param null|int $srid
5450
* @return \Illuminate\Support\Fluent
5551
*/
5652
public function polygon($column, $srid = null)
@@ -61,9 +57,8 @@ public function polygon($column, $srid = null)
6157
/**
6258
* Add a multipoint column on the table.
6359
*
64-
* @param string $column
65-
* @param null|int $srid
66-
*
60+
* @param string $column
61+
* @param null|int $srid
6762
* @return \Illuminate\Support\Fluent
6863
*/
6964
public function multiPoint($column, $srid = null)
@@ -74,9 +69,8 @@ public function multiPoint($column, $srid = null)
7469
/**
7570
* Add a multilinestring column on the table.
7671
*
77-
* @param string $column
78-
* @param null|int $srid
79-
*
72+
* @param string $column
73+
* @param null|int $srid
8074
* @return \Illuminate\Support\Fluent
8175
*/
8276
public function multiLineString($column, $srid = null)
@@ -87,9 +81,8 @@ public function multiLineString($column, $srid = null)
8781
/**
8882
* Add a multipolygon column on the table.
8983
*
90-
* @param string $column
91-
* @param null|int $srid
92-
*
84+
* @param string $column
85+
* @param null|int $srid
9386
* @return \Illuminate\Support\Fluent
9487
*/
9588
public function multiPolygon($column, $srid = null)
@@ -100,9 +93,8 @@ public function multiPolygon($column, $srid = null)
10093
/**
10194
* Add a geometrycollection column on the table.
10295
*
103-
* @param string $column
104-
* @param null|int $srid
105-
*
96+
* @param string $column
97+
* @param null|int $srid
10698
* @return \Illuminate\Support\Fluent
10799
*/
108100
public function geometryCollection($column, $srid = null)
@@ -113,9 +105,8 @@ public function geometryCollection($column, $srid = null)
113105
/**
114106
* Specify a spatial index for the table.
115107
*
116-
* @param string|array $columns
117-
* @param string $name
118-
*
108+
* @param string|array $columns
109+
* @param string $name
119110
* @return \Illuminate\Support\Fluent
120111
*/
121112
public function spatialIndex($columns, $name = null)
@@ -126,8 +117,7 @@ public function spatialIndex($columns, $name = null)
126117
/**
127118
* Indicate that the given index should be dropped.
128119
*
129-
* @param string|array $index
130-
*
120+
* @param string|array $index
131121
* @return \Illuminate\Support\Fluent
132122
*/
133123
public function dropSpatialIndex($index)

src/Schema/Builder.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ class Builder extends MySqlBuilder
1010
/**
1111
* Create a new command set with a Closure.
1212
*
13-
* @param string $table
14-
* @param Closure $callback
15-
*
13+
* @param string $table
14+
* @param Closure $callback
1615
* @return Blueprint
1716
*/
1817
protected function createBlueprint($table, Closure $callback = null)

src/Schema/Grammars/MySqlGrammar.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ class MySqlGrammar extends IlluminateMySqlGrammar
1313
public function __construct()
1414
{
1515
// Enable SRID as a column modifier
16-
if (!in_array(self::COLUMN_MODIFIER_SRID, $this->modifiers)) {
16+
if (! in_array(self::COLUMN_MODIFIER_SRID, $this->modifiers)) {
1717
$this->modifiers[] = self::COLUMN_MODIFIER_SRID;
1818
}
1919
}
2020

2121
/**
2222
* Adds a statement to add a geometry column.
2323
*
24-
* @param Fluent $column
2524
*
2625
* @return string
2726
*/
@@ -33,7 +32,6 @@ public function typeGeometry(Fluent $column)
3332
/**
3433
* Adds a statement to add a point column.
3534
*
36-
* @param Fluent $column
3735
*
3836
* @return string
3937
*/
@@ -45,7 +43,6 @@ public function typePoint(Fluent $column)
4543
/**
4644
* Adds a statement to add a linestring column.
4745
*
48-
* @param Fluent $column
4946
*
5047
* @return string
5148
*/
@@ -57,7 +54,6 @@ public function typeLinestring(Fluent $column)
5754
/**
5855
* Adds a statement to add a polygon column.
5956
*
60-
* @param Fluent $column
6157
*
6258
* @return string
6359
*/
@@ -69,7 +65,6 @@ public function typePolygon(Fluent $column)
6965
/**
7066
* Adds a statement to add a multipoint column.
7167
*
72-
* @param Fluent $column
7368
*
7469
* @return string
7570
*/
@@ -81,7 +76,6 @@ public function typeMultipoint(Fluent $column)
8176
/**
8277
* Adds a statement to add a multilinestring column.
8378
*
84-
* @param Fluent $column
8579
*
8680
* @return string
8781
*/
@@ -93,7 +87,6 @@ public function typeMultilinestring(Fluent $column)
9387
/**
9488
* Adds a statement to add a multipolygon column.
9589
*
96-
* @param Fluent $column
9790
*
9891
* @return string
9992
*/
@@ -105,7 +98,6 @@ public function typeMultipolygon(Fluent $column)
10598
/**
10699
* Adds a statement to add a geometrycollection column.
107100
*
108-
* @param Fluent $column
109101
*
110102
* @return string
111103
*/
@@ -117,8 +109,6 @@ public function typeGeometrycollection(Fluent $column)
117109
/**
118110
* Compile a spatial index key command.
119111
*
120-
* @param Blueprint $blueprint
121-
* @param Fluent $command
122112
*
123113
* @return string
124114
*/
@@ -130,14 +120,12 @@ public function compileSpatial(Blueprint $blueprint, Fluent $command)
130120
/**
131121
* Get the SQL for a SRID column modifier.
132122
*
133-
* @param \Illuminate\Database\Schema\Blueprint $blueprint
134-
* @param Fluent $column
135123
*
136124
* @return string|null
137125
*/
138126
protected function modifySrid(\Illuminate\Database\Schema\Blueprint $blueprint, Fluent $column)
139127
{
140-
if (!is_null($column->srid) && is_int($column->srid) && $column->srid > 0) {
128+
if (! is_null($column->srid) && is_int($column->srid) && $column->srid > 0) {
141129
return ' srid '.$column->srid;
142130
}
143131
}

src/SpatialServiceProvider.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ public function register()
4444
if (class_exists(DoctrineType::class)) {
4545
// Prevent geometry type fields from throwing a 'type not found' error when changing them
4646
$geometries = [
47-
'geometry' => Geometry::class,
48-
'point' => Point::class,
49-
'linestring' => LineString::class,
50-
'polygon' => Polygon::class,
51-
'multipoint' => MultiPoint::class,
52-
'multilinestring' => MultiLineString::class,
53-
'multipolygon' => MultiPolygon::class,
47+
'geometry' => Geometry::class,
48+
'point' => Point::class,
49+
'linestring' => LineString::class,
50+
'polygon' => Polygon::class,
51+
'multipoint' => MultiPoint::class,
52+
'multilinestring' => MultiLineString::class,
53+
'multipolygon' => MultiPolygon::class,
5454
'geometrycollection' => GeometryCollection::class,
5555
];
5656
$typeNames = array_keys(DoctrineType::getTypesMap());
5757
foreach ($geometries as $type => $class) {
58-
if (!in_array($type, $typeNames)) {
58+
if (! in_array($type, $typeNames)) {
5959
DoctrineType::addType($type, $class);
6060
}
6161
}

src/Types/GeometryCollection.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class GeometryCollection extends Geometry implements IteratorAggregate, ArrayAcc
3636
protected $items = [];
3737

3838
/**
39-
* @param GeometryInterface[] $geometries
40-
* @param int $srid
39+
* @param GeometryInterface[] $geometries
40+
* @param int $srid
4141
*
4242
* @throws InvalidArgumentException
4343
*/
@@ -129,7 +129,7 @@ public static function fromJson($geoJson)
129129
$geoJson = GeoJson::jsonUnserialize(json_decode($geoJson));
130130
}
131131

132-
if (!is_a($geoJson, FeatureCollection::class)) {
132+
if (! is_a($geoJson, FeatureCollection::class)) {
133133
throw new InvalidGeoJsonException('Expected '.FeatureCollection::class.', got '.get_class($geoJson));
134134
}
135135

@@ -158,8 +158,6 @@ public function jsonSerialize()
158158

159159
/**
160160
* Checks whether the items are valid to create this collection.
161-
*
162-
* @param array $items
163161
*/
164162
protected function validateItems(array $items)
165163
{
@@ -173,7 +171,6 @@ protected function validateItems(array $items)
173171
/**
174172
* Checks whether the array has enough items to generate a valid WKT.
175173
*
176-
* @param array $items
177174
*
178175
* @see $minimumCollectionItems
179176
*/
@@ -194,13 +191,12 @@ protected function validateItemCount(array $items)
194191
/**
195192
* Checks the type of the items in the array.
196193
*
197-
* @param $item
198194
*
199195
* @see $collectionItemType
200196
*/
201197
protected function validateItemType($item)
202198
{
203-
if (!$item instanceof $this->collectionItemType) {
199+
if (! $item instanceof $this->collectionItemType) {
204200
throw new InvalidArgumentException(sprintf(
205201
'%s must be a collection of %s',
206202
get_class($this),

src/Types/LineString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function fromJson($geoJson)
4848
$geoJson = GeoJson::jsonUnserialize(json_decode($geoJson));
4949
}
5050

51-
if (!is_a($geoJson, GeoJsonLineString::class)) {
51+
if (! is_a($geoJson, GeoJsonLineString::class)) {
5252
throw new InvalidGeoJsonException('Expected '.GeoJsonLineString::class.', got '.get_class($geoJson));
5353
}
5454

src/Types/MultiLineString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static function fromJson($geoJson)
6262
$geoJson = GeoJson::jsonUnserialize(json_decode($geoJson));
6363
}
6464

65-
if (!is_a($geoJson, GeoJsonMultiLineString::class)) {
65+
if (! is_a($geoJson, GeoJsonMultiLineString::class)) {
6666
throw new InvalidGeoJsonException('Expected '.GeoJsonMultiLineString::class.', got '.get_class($geoJson));
6767
}
6868

0 commit comments

Comments
 (0)