- Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.15
- Fatal error: Default value for parameters with a class type hint can only be NULL in /in/QnZef on line 6
Process exited with code 255.
<?php
class integer {
private $value;
public function __construct(int $value = 0) : int
{
$this->value = $value;
return $this->value;
}
public function __invoke(int ...$value) : int
{
if (count($value) === 1)
$this->value = $value[0];
else
throw new Exception('Multiple values given.');
return $this->value;
}
}
$testi = new integer(1);
$testi(2);