Bom dia, fiz como no vídeo no entanto estou com o seguinte erro após implementar o método __get:
Documentos/PHP_Alura/PHP_OO$ php enderecos.php PHP Notice: Undefined variable: rua in /home/helio/Documentos/PHP_Alura/PHP_OO/src/Modelo/Endereco.php on line 32 PHP Fatal error: Uncaught Error: Call to undefined method Alura\Banco\Modelo\Endereco::recupera() in /home/helio/Documentos/PHP_Alura/PHP_OO/src/Modelo/Endereco.php:49 Stack trace:
#0 /home/helio/Documentos/PHP_Alura/PHP_OO/src/Modelo/Endereco.php(32): Alura\Banco\Modelo\Endereco->__get()
#1 /home/helio/Documentos/PHP_Alura/PHP_OO/src/Modelo/Endereco.php(49): Alura\Banco\Modelo\Endereco->recuperaRua()
#2 /home/helio/Documentos/PHP_Alura/PHP_OO/enderecos.php(19): Alura\Banco\Modelo\Endereco->__get()
#3 {main} thrown in /home/helio/Documentos/PHP_Alura/PHP_OO/src/Modelo/Endereco.php on line 49
Abaixo minha classe Endereco:
<?php
namespace Alura\Banco\Modelo;
class Endereco
{
  private string $cidade;
  private string $bairro;
  private string $rua;
  private string $numero;
  public function __construct(string $cidade, string $bairro, string $rua, string $numero)
  {
    $this->cidade = $cidade;
    $this->bairro = $bairro;
    $this->rua = $rua;
    $this->numero = $numero;
  }
  public function recuperaCidade(): string 
  {
    return $this->$cidade;
  }
  public function recuperaBairro(): string 
  {
    return $this->$bairro;
  }
  public function recuperaRua(): string 
  {
    return $this->$rua;
  }
  public function recuperaNumero(): string 
  { 
    return $this->$numero;
  }
  public function __toString(): string
  {
      return "{$this->rua}, {$this->numero}, {$this->bairro}, {$this->cidade}";
  }
  public function __get(string $nomeAtributo)
  {
      $metodo = 'recupera' . ucfirst($nomeAtributo);
      //echo $metodo; exit();
      return $this->$metodo();
  }
}abaixo meu arquivo enderecos.php:
<?php
use Alura\Banco\Modelo\Endereco;
require_once 'autoload.php';
$umEndereco = new Endereco(
    'Petrópolis',
    'bairro qualquer',
    'Minha rua',
    '71b'
);
$outroEndereco = new Endereco(
    'Rio',
    'Centro',
    'Uma rua aí',
    '50'
);
echo $umEndereco->rua;muito obrigado pela atenção
 
            