protected function renderAssertion(Assertion $assert) { $kind = $assert->getKind(); if ($assert->value instanceof Operand) { return $kind . '(' . $this->renderOperand($assert->value) . ')'; } $combinator = $assert->mode === Assertion::MODE_UNION ? "|" : '&'; $results = []; foreach ($assert->value as $child) { $results[] = $this->renderAssertion($child); } return $kind . '(' . implode($combinator, $results) . ')'; }
/** * @param Assertion[]|Operand $value */ public function __construct($value) { parent::__construct($value, self::MODE_INTERSECTION); }