Add PHPMD to build and fix errors