test: implement static funcions and catch blocks

Allow the php source analyzer scan for $this in static functions as well as
properly handle the exception variable inside catch blocks.