Skip to content

Commit eefa3ff

Browse files
committed
Add and apply trailing_comma_in_multiline rule
1 parent 0f50bf7 commit eefa3ff

File tree

5 files changed

+53
-49
lines changed

5 files changed

+53
-49
lines changed

.php-cs-fixer.dist.php

+4
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,9 @@
3131
],
3232
],
3333
'single_line_throw' => false,
34+
'trailing_comma_in_multiline' => [
35+
'after_heredoc' => true,
36+
'elements' => ['arrays', 'arguments', 'parameters'],
37+
],
3438
])
3539
->setFinder($finder);

src/Assert.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static function point(Point $point): void
6868
) {
6969
throw MissingCoordinateException::create(
7070
'Z',
71-
$dimension
71+
$dimension,
7272
);
7373
}
7474

@@ -84,7 +84,7 @@ public static function point(Point $point): void
8484
) {
8585
throw MissingCoordinateException::create(
8686
'M',
87-
$dimension
87+
$dimension,
8888
);
8989
}
9090
}
@@ -99,7 +99,7 @@ public static function lineString(LineString $lineString): void
9999
throw InsufficientNumberOfGeometriesException::create(
100100
2,
101101
$count,
102-
'Point'
102+
'Point',
103103
);
104104
}
105105

@@ -120,7 +120,7 @@ public static function linearRing(LinearRing $linearRing): void
120120
throw InsufficientNumberOfGeometriesException::create(
121121
4,
122122
$count,
123-
'Point'
123+
'Point',
124124
);
125125
}
126126

src/Factory.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function createPoint(
1919
return new Point(
2020
$dimension,
2121
$srid,
22-
$coordinates
22+
$coordinates,
2323
);
2424
}
2525

@@ -34,7 +34,7 @@ public function createLineString(
3434
return new LineString(
3535
$dimension,
3636
$srid,
37-
...$points
37+
...$points,
3838
);
3939
}
4040

@@ -49,7 +49,7 @@ public function createLinearRing(
4949
return new LinearRing(
5050
$dimension,
5151
$srid,
52-
...$points
52+
...$points,
5353
);
5454
}
5555

@@ -64,7 +64,7 @@ public function createPolygon(
6464
return new Polygon(
6565
$dimension,
6666
$srid,
67-
...$linearRings
67+
...$linearRings,
6868
);
6969
}
7070

@@ -79,7 +79,7 @@ public function createMultiPoint(
7979
return new MultiPoint(
8080
$dimension,
8181
$srid,
82-
...$points
82+
...$points,
8383
);
8484
}
8585

@@ -94,7 +94,7 @@ public function createMultiLineString(
9494
return new MultiLineString(
9595
$dimension,
9696
$srid,
97-
...$lineStrings
97+
...$lineStrings,
9898
);
9999
}
100100

@@ -109,7 +109,7 @@ public function createMultiPolygon(
109109
return new MultiPolygon(
110110
$dimension,
111111
$srid,
112-
...$polygons
112+
...$polygons,
113113
);
114114
}
115115

@@ -124,7 +124,7 @@ public function createGeometryCollection(
124124
return new GeometryCollection(
125125
$dimension,
126126
$srid,
127-
...$geometries
127+
...$geometries,
128128
);
129129
}
130130

tests/ExtractorTest.php

+35-35
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testExtractDimension(): void
5656
$object = new Point(
5757
Dimension::DIMENSION_4D,
5858
1234,
59-
new Coordinates(1, 2, 3, 4)
59+
new Coordinates(1, 2, 3, 4),
6060
);
6161

6262
$extractor = new Extractor();
@@ -76,7 +76,7 @@ public function testExtractSrid(): void
7676
$object = new Point(
7777
Dimension::DIMENSION_4D,
7878
1234,
79-
new Coordinates(1, 2, 3, 4)
79+
new Coordinates(1, 2, 3, 4),
8080
);
8181

8282
$extractor = new Extractor();
@@ -96,7 +96,7 @@ public function testExtractCoordinatesFromPoint(): void
9696
$object = new Point(
9797
Dimension::DIMENSION_4D,
9898
1234,
99-
new Coordinates(1, 2, 3, 4)
99+
new Coordinates(1, 2, 3, 4),
100100
);
101101

102102
$extractor = new Extractor();
@@ -112,7 +112,7 @@ public function testExtractCoordinatesFromPoint(): void
112112
public function testExtractCoordinatesFromPointReturnsNullForEmptyPoint(): void
113113
{
114114
$object = new Point(
115-
Dimension::DIMENSION_4D
115+
Dimension::DIMENSION_4D,
116116
);
117117

118118
$extractor = new Extractor();
@@ -134,19 +134,19 @@ public function testExtractLineString(): void
134134
new Point(
135135
Dimension::DIMENSION_4D,
136136
1234,
137-
new Coordinates(1, 2, 3, 4)
137+
new Coordinates(1, 2, 3, 4),
138138
),
139139
new Point(
140140
Dimension::DIMENSION_4D,
141141
1234,
142-
new Coordinates(1, 2, 3, 4)
142+
new Coordinates(1, 2, 3, 4),
143143
),
144144
];
145145

146146
$object = new LineString(
147147
Dimension::DIMENSION_4D,
148148
1234,
149-
...$points
149+
...$points,
150150
);
151151

152152
$extractor = new Extractor();
@@ -173,30 +173,30 @@ public function testExtractPolygon(): void
173173
new Point(
174174
Dimension::DIMENSION_4D,
175175
1234,
176-
new Coordinates(1, 2, 3, 4)
176+
new Coordinates(1, 2, 3, 4),
177177
),
178178
new Point(
179179
Dimension::DIMENSION_4D,
180180
1234,
181-
new Coordinates(1, 2, 3, 4)
181+
new Coordinates(1, 2, 3, 4),
182182
),
183183
new Point(
184184
Dimension::DIMENSION_4D,
185185
1234,
186-
new Coordinates(1, 2, 3, 4)
186+
new Coordinates(1, 2, 3, 4),
187187
),
188188
new Point(
189189
Dimension::DIMENSION_4D,
190190
1234,
191-
new Coordinates(1, 2, 3, 4)
192-
)
191+
new Coordinates(1, 2, 3, 4),
192+
),
193193
),
194194
];
195195

196196
$object = new Polygon(
197197
Dimension::DIMENSION_4D,
198198
1234,
199-
...$lineStrings
199+
...$lineStrings,
200200
);
201201

202202
$extractor = new Extractor();
@@ -220,19 +220,19 @@ public function testExtractMultiPoint(): void
220220
new Point(
221221
Dimension::DIMENSION_4D,
222222
1234,
223-
new Coordinates(1, 2, 3, 4)
223+
new Coordinates(1, 2, 3, 4),
224224
),
225225
new Point(
226226
Dimension::DIMENSION_4D,
227227
1234,
228-
new Coordinates(1, 2, 3, 4)
228+
new Coordinates(1, 2, 3, 4),
229229
),
230230
];
231231

232232
$object = new MultiPoint(
233233
Dimension::DIMENSION_4D,
234234
1234,
235-
...$points
235+
...$points,
236236
);
237237

238238
$extractor = new Extractor();
@@ -259,30 +259,30 @@ public function testExtractMultiLineString(): void
259259
new Point(
260260
Dimension::DIMENSION_4D,
261261
1234,
262-
new Coordinates(1, 2, 3, 4)
262+
new Coordinates(1, 2, 3, 4),
263263
),
264264
new Point(
265265
Dimension::DIMENSION_4D,
266266
1234,
267-
new Coordinates(1, 2, 3, 4)
267+
new Coordinates(1, 2, 3, 4),
268268
),
269269
new Point(
270270
Dimension::DIMENSION_4D,
271271
1234,
272-
new Coordinates(1, 2, 3, 4)
272+
new Coordinates(1, 2, 3, 4),
273273
),
274274
new Point(
275275
Dimension::DIMENSION_4D,
276276
1234,
277-
new Coordinates(1, 2, 3, 4)
278-
)
277+
new Coordinates(1, 2, 3, 4),
278+
),
279279
),
280280
];
281281

282282
$object = new MultiLineString(
283283
Dimension::DIMENSION_4D,
284284
1234,
285-
...$lineStrings
285+
...$lineStrings,
286286
);
287287

288288
$extractor = new Extractor();
@@ -312,31 +312,31 @@ public function testExtractMultiPolygon(): void
312312
new Point(
313313
Dimension::DIMENSION_4D,
314314
1234,
315-
new Coordinates(1, 2, 3, 4)
315+
new Coordinates(1, 2, 3, 4),
316316
),
317317
new Point(
318318
Dimension::DIMENSION_4D,
319319
1234,
320-
new Coordinates(1, 2, 3, 4)
320+
new Coordinates(1, 2, 3, 4),
321321
),
322322
new Point(
323323
Dimension::DIMENSION_4D,
324324
1234,
325-
new Coordinates(1, 2, 3, 4)
325+
new Coordinates(1, 2, 3, 4),
326326
),
327327
new Point(
328328
Dimension::DIMENSION_4D,
329329
1234,
330-
new Coordinates(1, 2, 3, 4)
331-
)
330+
new Coordinates(1, 2, 3, 4),
331+
),
332332
),
333333
),
334334
];
335335

336336
$object = new MultiPolygon(
337337
Dimension::DIMENSION_4D,
338338
1234,
339-
...$polygons
339+
...$polygons,
340340
);
341341

342342
$extractor = new Extractor();
@@ -360,38 +360,38 @@ public function testExtractGeometryCollection(): void
360360
new Point(
361361
Dimension::DIMENSION_4D,
362362
1234,
363-
new Coordinates(1, 2, 3, 4)
363+
new Coordinates(1, 2, 3, 4),
364364
),
365365
new LinearRing(
366366
Dimension::DIMENSION_4D,
367367
1234,
368368
new Point(
369369
Dimension::DIMENSION_4D,
370370
1234,
371-
new Coordinates(1, 2, 3, 4)
371+
new Coordinates(1, 2, 3, 4),
372372
),
373373
new Point(
374374
Dimension::DIMENSION_4D,
375375
1234,
376-
new Coordinates(1, 2, 3, 4)
376+
new Coordinates(1, 2, 3, 4),
377377
),
378378
new Point(
379379
Dimension::DIMENSION_4D,
380380
1234,
381-
new Coordinates(1, 2, 3, 4)
381+
new Coordinates(1, 2, 3, 4),
382382
),
383383
new Point(
384384
Dimension::DIMENSION_4D,
385385
1234,
386-
new Coordinates(1, 2, 3, 4)
387-
)
386+
new Coordinates(1, 2, 3, 4),
387+
),
388388
),
389389
];
390390

391391
$object = new GeometryCollection(
392392
Dimension::DIMENSION_4D,
393393
1234,
394-
...$geometries
394+
...$geometries,
395395
);
396396

397397
$extractor = new Extractor();

tests/PointTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function testConstructorShouldThrowExceptionForMissingZCoordinate(): void
1818
new Point(
1919
Dimension::DIMENSION_3DZ,
2020
4326,
21-
new Coordinates(1, 2)
21+
new Coordinates(1, 2),
2222
);
2323
}
2424

@@ -29,7 +29,7 @@ public function testConstructorShouldThrowExceptionForMissingMCoordinate(): void
2929
new Point(
3030
Dimension::DIMENSION_3DM,
3131
4326,
32-
new Coordinates(1, 2, 3)
32+
new Coordinates(1, 2, 3),
3333
);
3434
}
3535

0 commit comments

Comments
 (0)