class Foo { /** @var array<int, array{id: string, num_order: string}> */ protected array $orders = []; public function setOrders(array $orders): self { Assert::allCount($orders, 2); Assert::allKeyExists($orders, 'id'); Assert::allKeyExists($orders, 'num_order'); $this->orders = $orders; return $this; } }