Fix PHPDoc and vaiable typing, optimize imports, and generally improve PSR-1/2
fix type mismatch