protected function handle($client) { $trans = $this->transportFactory->getTransport($client); $prot = $this->protocolFactory->getProtocol($trans); $this->_clientBegin($prot); try { if (!$trans instanceof TTransportStatus || \hacklib_cast_as_boolean($trans->isReadable())) { $this->processor->process($prot, $prot); } } catch (Exception $x) { $md = $client->getMetaData(); if (\hacklib_cast_as_boolean($md[\hacklib_id("timed_out")])) { } else { if (\hacklib_cast_as_boolean($md[\hacklib_id("eof")])) { \HH\invariant($trans instanceof TTransport, "Need to make Hack happy"); $trans->close(); return false; } else { echo "Handle caught transport exception: " . $x->getMessage() . "\n"; } } } return true; }
<?php var_dump(HH\invariant(3));
public function readSetEnd() { $this->stack->pop(); $val = $this->stack->lastValue(); \HH\invariant($val !== null, "Stack is empty, this shouldn't happen!"); $this->top = $val; }
public function handlerError($handler_context, $fn_name, $ex) { \HH\invariant($handler_context instanceof \HH\Map, 'Context is not a Map'); foreach ($this->handlers as $key => $handler) { $handler->handlerError($handler_context->at($key), $fn_name, $ex); } }
function f() { \HH\invariant(1 == 1, 'test'); \HH\invariant_violation('test2'); }
function f() { \HH\invariant(1 == 1, "test"); \HH\invariant_violation("test2"); }