Use new static() in Usage::fromArray() for late static binding

Required since the class is no longer final and the return type
is static, so subclasses get the correct type.
This commit is contained in:
Chirag Aggarwal
2026-04-01 19:52:16 +05:30
parent d531c29fc8
commit fb96aecbef
+1 -1
View File
@@ -40,7 +40,7 @@ class Usage extends Base
*/
public static function fromArray(array $data): static
{
return new self(
return new static(
project: new Document($data['project'] ?? []),
metrics: $data['metrics'] ?? [],
reduce: array_map(fn (array $doc) => new Document($doc), $data['reduce'] ?? []),