I came across something that does not seem to make sense, when I try to call the method of a direct object in its instance it does not seem to work.
class Pessoa{
private $Nome;
private $Idade;
public function __construct($nome){
$this->Nome = $nome;
}
public function getNome(){
return $this->Nome;
}
}
print new Pessoa("Vinicius")->getNome();
Parse error: syntax error, unexpected T_OBJECT_OPERATOR
However when I use a variable to reference the object the call works
$eu = new Pessoa("Vinicius");
print $eu->getNome();
Is there an error in the syntax of the first example?