Add missing PHPDoc comments and type hints

There are like a billion things missing in the inline documentation
of this extension. Wow. This is what I can do for now.

Change-Id: I019c24d13cf5cb22dde4d710b86ef8f976e1ec96