09.01.2015 Views

Hacking with HHVM

Hacking with HHVM

Hacking with HHVM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

HACK<br />

num += $delta;<br />

return $this;<br />

}<br />

public function get(): int {<br />

return $this->num;<br />

}<br />

public function __constructor(int $num): void {<br />

$this->num = $num;<br />

}<br />

$f = new Foo(123);<br />

$f->add(456);<br />

$f->add(“banana”);<br />

Basic Hack<br />

▪ Static Analyzer traces value<br />

through whole program<br />

▪ Looks for mismatches and<br />

reports errors<br />

▪ “Foo::add() expected int”<br />

“Foo::add() received string”

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!