From 2363bbaa756848b30b48db620b5decb8ad3a439d Mon Sep 17 00:00:00 2001 From: Arkadiusz Kondas Date: Mon, 12 Dec 2016 19:02:09 +0100 Subject: [PATCH] Add type hint and exceptions annotation --- src/Phpml/Clustering/KMeans/Cluster.php | 2 ++ src/Phpml/Clustering/KMeans/Point.php | 4 ++-- src/Phpml/Clustering/KMeans/Space.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Phpml/Clustering/KMeans/Cluster.php b/src/Phpml/Clustering/KMeans/Cluster.php index c160b6c2..28fa8aff 100644 --- a/src/Phpml/Clustering/KMeans/Cluster.php +++ b/src/Phpml/Clustering/KMeans/Cluster.php @@ -60,6 +60,8 @@ public function toArray() * @param Point $point * * @return Point + * + * @throws \LogicException */ public function attach(Point $point) { diff --git a/src/Phpml/Clustering/KMeans/Point.php b/src/Phpml/Clustering/KMeans/Point.php index a8d72e5b..ce1c44ee 100644 --- a/src/Phpml/Clustering/KMeans/Point.php +++ b/src/Phpml/Clustering/KMeans/Point.php @@ -53,11 +53,11 @@ public function getDistanceWith(self $point, $precise = true) } /** - * @param $points + * @param array $points * * @return mixed */ - public function getClosest($points) + public function getClosest(array $points) { foreach ($points as $point) { $distance = $this->getDistanceWith($point, false); diff --git a/src/Phpml/Clustering/KMeans/Space.php b/src/Phpml/Clustering/KMeans/Space.php index 40b1f1d8..49ded31c 100644 --- a/src/Phpml/Clustering/KMeans/Space.php +++ b/src/Phpml/Clustering/KMeans/Space.php @@ -65,7 +65,7 @@ public function addPoint(array $coordinates, $data = null) } /** - * @param object $point + * @param Point $point * @param null $data */ public function attach($point, $data = null)