Fix PHP CodeSniffer warnings and errors

Also apply formatting convention.

Change-Id: I792210d0d1c5f9089a71cecba95e17822f6da0e3
Merge "Fix PHP CodeSniffer warnings and errors"