is this code correct not in terms of functionality, because works. In terms of encapsulation etcetera? IMO is weird parent doesn’t have a constructor. But I think parent doesn’t need a constructor in this case? What do you think? Thanks.
class DTO extends ParentDTO
{
public function __construct(
protected ?bool $test,
protected string $message,
) {}
public function test(): ?bool
{
return $this->test;
}
}
abstract class ParentDTO
{
protected string $message;
public function message(): ?bool
{
return $this->message;
}
}