fix type hint

This commit is contained in:
Dennis Eichhorn 2020-01-01 21:31:15 +01:00
parent a75025c1a0
commit d8bf78c7b4
3 changed files with 6 additions and 5 deletions

View File

@ -136,6 +136,7 @@ final class Kmeans
foreach ($points as $point) { foreach ($points as $point) {
$clusterPoint = $clusterCenters[$point->getGroup()]; $clusterPoint = $clusterCenters[$point->getGroup()];
// this should ensure that clusterPoint and therfore the center group is never 0. But this is not true.
$clusterPoint->setGroup( $clusterPoint->setGroup(
$clusterPoint->getGroup() + 1 $clusterPoint->getGroup() + 1
); );

View File

@ -27,7 +27,7 @@ class Point implements PointInterface
/** /**
* Coordinates of the point * Coordinates of the point
* *
* @var array * @var array<int, int|float>
* @sicne 1.0.0 * @sicne 1.0.0
*/ */
private array $coordinates = []; private array $coordinates = [];
@ -81,7 +81,7 @@ class Point implements PointInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setCoordinate($index, $value) public function setCoordinate($index, $value) : void
{ {
$this->coordinates[$index] = $value; $this->coordinates[$index] = $value;
} }

View File

@ -39,7 +39,7 @@ interface PointInterface
* *
* @param mixed $index Index of the coordinate (e.g. 0 = x); * @param mixed $index Index of the coordinate (e.g. 0 = x);
* *
* @return array * @return int|float
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -51,11 +51,11 @@ interface PointInterface
* @param mixed $index Index of the coordinate (e.g. 0 = x); * @param mixed $index Index of the coordinate (e.g. 0 = x);
* @param mixed $value Value of the coordinate * @param mixed $value Value of the coordinate
* *
* @return array * @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function setCoordinate($index, $value); public function setCoordinate($index, $value) : void;
/** /**
* Get group this point belongs to * Get group this point belongs to