- Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.6
- Fatal error: strict_types declaration must be the very first statement in the script in /in/LLU3X on line 48
Process exited with code 255.
<?php
declare(strict_types=1);
interface ValidatorInterface
{
public function validate($number);
}
interface LegacyValidatorInterface
{
public function validate($number, $deprecated = false);
}
class Validator implements LegacyValidatorInterface, ValidatorInterface
{
public function validate($number, $deprecated = false)
{
echo func_num_args();
echo "\n";
}
}
class Decorator implements ValidatorInterface
{
/**
* @var ValidatorInterface
*/
private $core;
/**
* @param ValidatorInterface $core
*/
public function __construct(ValidatorInterface $core)
{
$this->core = $core;
}
public function validate($number)
{
$this->core->validate($number);
}
}
declare(strict_types=1);
$v = new Decorator(new Validator());
$v->validate("1", false);
$v->validate("1");