$positions */ public function __construct( public string $teamId, public array $positions, ) { if ($teamId === '') { throw new InvalidArgumentException('Deployment zone team id cannot be empty.'); } if ($positions === []) { throw new InvalidArgumentException('Deployment zone must contain at least one position.'); } if (!array_is_list($positions)) { // @phpstan-ignore function.alreadyNarrowedType (Runtime guard: PHPDoc is not a runtime contract for JSON-sourced arrays in Plan 4.) throw new InvalidArgumentException('Deployment zone positions must be a list.'); } } public function contains(Position $position): bool { foreach ($this->positions as $candidate) { if ($candidate->key() === $position->key()) { return true; } } return false; } }