*/ public array $orderBy = []; /** @return array */ final public function orderBy(): array { return $this->orderBy; } /** @psalm-assert-if-true !null $this->indexBy */ final public function isIndexed(): bool { return $this->indexBy !== null; } final public function indexBy(): string { if (! $this->isIndexed()) { throw new LogicException(sprintf( 'This mapping is not indexed. Use %s::isIndexed() to check that before calling %s.', self::class, __METHOD__, )); } return $this->indexBy; } /** @return list */ public function __sleep(): array { $serialized = parent::__sleep(); if ($this->indexBy !== null) { $serialized[] = 'indexBy'; } if ($this->orderBy !== []) { $serialized[] = 'orderBy'; } return $serialized; } }