public function withRecursionDepth($depth) { if (null !== $depth && !(is_int($depth) && $depth >= 0)) { $msg = 'Recursion depth must be null (infinite) or integer >= 0!'; throw new \InvalidArgumentException($msg); } $self = clone $this; $self->recursionDepth = $depth; return $self; }
public function testExceptionOnInvalidRecursionDepth() { $processor = new Processor(new RegularParser(), new HandlerContainer()); $this->setExpectedException('InvalidArgumentException'); $processor->withRecursionDepth(new \stdClass()); }