<?php
namespace Sandbox;
class Sandbox {
private Connectors\ISandboxConnector $connection;
public function __construct(Connectors\ISandboxConnector $conn) {
$this->connection = $conn;
}
}
?>
对于上面的代码,我收到以下错误:
Parse error: syntax error, unexpected 'Connectors' (T_STRING), expecting variable (T_VARIABLE)
当我删除类型提示和var_dump
$connection 变量时,它将是private Sandbox\Sandbox
而不是Sandbox\Connectors\ISandboxconnector
,为什么?