class Foo<br>
{<br>
public $bar {<br>
get;<br>
set($bar) {<br>
if(!is_int($bar)) {<br>
throw new \InvalidArgumentException('Bar should be integer!');<br>
}<br>
return $bar;<br>
}<br>
}<br>
}<br>