<?php
use src\Endereco;
class Titular extends Pessoa
{
private Endereco $endereco;
public function __construct( CPF $cpf, string $nome, Endereco $endereco)
{
$this->cpf = $cpf;
$this->validaNomeTitular($nome);
$this->nome = $nome;
$this->endereco = $endereco;
}
public function recuperaCpf(): string
{
return $this->cpf->recuperaNumero();
}
public function recuperaNome(): string
{
return $this->nome;
}
public function recuperaEndereco(): Endereco {
return $this->endereco;
}
}
** Erro inteiro: " PHP Fatal error: Uncaught TypeError: Typed property Pessoa::$cpf must be string, CPF used in C:\Users\alefr\Desktop\Aula dev front end\php\Projeto\src\Titular.php:13 Stack trace:
#0 C:\Users\alefr\Desktop\Aula dev front end\php\Projeto\bancoA.php(13): Titular->__construct(Object(CPF), 'Vinicius Dias', Object(src\Endereco))
#1 {main} thrown in C:\Users\alefr\Desktop\Aula dev front end\php\Projeto\src\Titular.php on line 13" **