<?php

class bug
{
   public function on(\Closure $closure) {
      $closure = $closure->bindTo($this);
      $closure();
   }
}

$bug = new bug();
$bug->on(function() {
   throw new \Exception("Exception thrown successfully");
});
