Fix CodeSniffer errors and warnings on a number of ApiQuery classes

Change-Id: I763f79c66cd8ed2ca19586323d5b3ee8b60ffd18