0

I am currently working my way into an existing Laravel project. In one class I found the following method:

public static function someEncodedString($encodedString): static
{
    return new static(base64_decode((string) $encodedString));
}

I wonder what the return type static means. And why return a static object at all. Why do you do that?

MartinTTS
  • 111
  • 8
  • You have a `static` function, using a late `static` binding, and I don't even know what the trailing `static` is (moved away from PHP a long time ago). That said, much like `static` in other languages, prolific use can lead to abandoning OOP design in favor of something more procedural. – Rogue Apr 25 '23 at 13:50

0 Answers0