abstract class Controller {
protected $registry;
protected $customer,
public function __construct(Registry $registry) {
$this->registry = $registry;
}
public function getCustomer(): Customer {
return $customer;
}
But type declaration for the properties will cause errors like "Parse error: syntax error, unexpected 'Registry' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)":
protected Registry $registry;
protected Customer $customer;
Typed properties was introduced in PHP 7.4.
No comments:
Post a Comment