当我运行这段代码
class Kernel
{
private $settings = array();
public function handle(Settings $conf)
{
$this->settings = $conf;
return $this;
}
public function run()
{
var_dump($this->settings);
}
}
class Settings
{
public static function appConfig()
{
return array(
'database' => array(
'hostname' => 'localhost',
'username' => 'root',
'password' => 'test',
'database' => 'testdb'
)
);
}
}
$kernel = new Kernel;
$kernel->handle(Settings::appConfig())->run();
我收到错误
Catchable fatal error: Argument 1 passed to Kernel::handle() must be an instance of Settings, array given, called in....
这是否意味着类型提示仅适用于实例而不适用于静态方法?如果现在如何实现静态方法的类型提示?