Fix CodeSniffer warnings and errors

Based on https://integration.wikimedia.org/ci/job/mwext-Translate-phpcs-HEAD/1545/consoleFull

Change-Id: I6428d0dd2345fca3d4993cc1de5e5ab4815b1ce4
Merge "Fix CodeSniffer warnings and errors"