<?php class A { public static function withSelf(): self { return new self(); } public static function withStatic(): static { return new static(); } } class B extends A {} var_dump(A::withSelf()); // output: A var_dump(B::withSelf()); // output: A var_dump(B::withStatic()); // output: B
You have javascript disabled. You will not be able to edit any code.