fix scalar typehint for hhvm

This commit is contained in:
Arkadiusz Kondas 2016-07-07 23:33:06 +02:00
parent 0a612a6031
commit f3288c5946

View File

@ -27,13 +27,13 @@ class KNearestNeighbors implements Classifier
* @param int $k
* @param Distance|null $distanceMetric (if null then Euclidean distance as default)
*/
public function __construct(int $k = 3, Distance $distanceMetric = null)
public function __construct(int $k = null, Distance $distanceMetric = null)
{
if (null === $distanceMetric) {
$distanceMetric = new Euclidean();
}
$this->k = $k;
$this->k = $k ?? 3;
$this->samples = [];
$this->targets = [];
$this->distanceMetric = $distanceMetric;