Fix some PHP errors and PHPCS errors