From 5108b2ca4f8c839daea7438ad1d00009927b2021 Mon Sep 17 00:00:00 2001 From: Benjamin Delespierre Date: Sun, 23 Aug 2020 21:38:19 +0200 Subject: [PATCH] fixing arrow function (not available in 7.3) --- tests/Kmeans/ClusterTest.php | 4 +++- tests/Kmeans/SpaceTest.php | 12 +++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/Kmeans/ClusterTest.php b/tests/Kmeans/ClusterTest.php index 9b2a5f0..022e4ec 100644 --- a/tests/Kmeans/ClusterTest.php +++ b/tests/Kmeans/ClusterTest.php @@ -35,7 +35,9 @@ class ClusterTest extends TestCase [ 'centroid' => $points[0]->toArray(), 'points' => array_map( - fn($p) => $p->toArray(), + function ($p) { + return $p->toArray(); + }, $points ), ], diff --git a/tests/Kmeans/SpaceTest.php b/tests/Kmeans/SpaceTest.php index 4f65f69..d4611a7 100644 --- a/tests/Kmeans/SpaceTest.php +++ b/tests/Kmeans/SpaceTest.php @@ -41,7 +41,9 @@ class SpaceTest extends TestCase } $this->assertEquals( - ['points' => array_map(fn($p) => $p->toArray(), $points)], + ['points' => array_map(function ($p) { + return $p->toArray(); + }, $points)], $space->toArray() ); } @@ -119,10 +121,14 @@ class SpaceTest extends TestCase $min = new Point($space, [0]); $max = new Point($space, [10]); - Space::setRng(fn($min, $max) => $min); + Space::setRng(function ($min, $max) { + return $min; + }); $this->assertEquals($min, $space->getRandomPoint($min, $max)); - Space::setRng(fn($min, $max) => $max); + Space::setRng(function ($min, $max) { + return $max; + }); $this->assertEquals($max, $space->getRandomPoint($min, $max)); }