Skip to content

Commit

Permalink
Arrow functions
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Oct 17, 2023
1 parent 777c3a2 commit 956b7c0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
4 changes: 1 addition & 3 deletions tests/CircularStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ class CircularStringTest extends AbstractTestCase
public function testCreate(array $pointsWKT, bool $is3D, bool $isMeasured, string $circularStringWKT) : void
{
foreach ([0, 1] as $srid) {
$instantiatePoint = function ($point) use ($srid) {
return Point::fromText($point, $srid);
};
$instantiatePoint = fn(string $point) => Point::fromText($point, $srid);

$cs = new CoordinateSystem($is3D, $isMeasured, $srid);
$circularString = new CircularString($cs, ...array_map($instantiatePoint, $pointsWKT));
Expand Down
4 changes: 1 addition & 3 deletions tests/CompoundCurveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ class CompoundCurveTest extends AbstractTestCase
public function testCreate(array $curvesWKT, bool $is3D, bool $isMeasured, string $compoundCurveWKT) : void
{
foreach ([0, 1] as $srid) {
$instantiateCurve = function ($curve) use ($srid) {
return Curve::fromText($curve, $srid);
};
$instantiateCurve = fn(string $curve) => Curve::fromText($curve, $srid);

$cs = new CoordinateSystem($is3D, $isMeasured, $srid);
$compoundCurve = new CompoundCurve($cs, ...array_map($instantiateCurve, $curvesWKT));
Expand Down
4 changes: 1 addition & 3 deletions tests/IO/GeoJSONReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ public function providerNonLenientReadWrongCaseType() : \Generator
*/
private function alterCase(string $geojson) : string
{
$callback = function(array $matches) : string {
return $matches[1] . strtoupper($matches[2]);
};
$callback = fn(array $matches): string => $matches[1] . strtoupper($matches[2]);

return preg_replace_callback('/("type"\s*\:\s*)("[^"]+")/', $callback, $geojson);
}
Expand Down
4 changes: 1 addition & 3 deletions tests/PolyhedralSurfaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ class PolyhedralSurfaceTest extends AbstractTestCase
public function testCreate(array $patchesWKT, bool $is3D, bool $isMeasured, string $polyhedralSurfaceWKT) : void
{
foreach ([0, 1] as $srid) {
$instantiatePolygon = function ($patch) use ($srid) {
return Polygon::fromText($patch, $srid);
};
$instantiatePolygon = fn(string $patch) => Polygon::fromText($patch, $srid);

$cs = new CoordinateSystem($is3D, $isMeasured, $srid);
$polyhedralSurface = new PolyhedralSurface($cs, ...array_map($instantiatePolygon, $patchesWKT));
Expand Down

0 comments on commit 956b7c0

Please sign in to comment.