Glossary

Late Static Binding (LSB)

Late Static Binding is a PHP mechanism that lets static methods refer to the class they were called on, not the class where they were defined. Use static:: instead of self::.

self vs static

class Base {
  public static function create(): static {
    return new static(); // the class it was called on
  }
  public static function name(): string {
    return static::class; // Late Static Binding
  }
}

class Child extends Base {}

Child::create(); // returns Child, not Base
Child::name();   // "Child", not "Base"

Where it is used