<?php
namespace Foo
{
interface FooInterface
{
public function foo(string $str);
}
}
namespace Bar
{
use Foo\FooInterface;
class BarClass implements FooInterface
{
public function foo(string $str) { }
}
if (version_compare(PHP_VERSION, '7.0', '<'))
{
function type_hint($code, $error)
{
if (strpos($error, 'string, string') !== false) {
return true;
}
if (strpos($error, 'int, integer') !== false) {
return true;
}
if (strpos($error, 'bool, boolean') !== false) {
return true;
}
if (strpos($error, 'float, double') !== false) {
return true;
}
return false;
}
}
set_error_handler('type_hint', E_RECOVERABLE_ERROR);
}
preferences:
53.97 ms | 402 KiB | 5 Q