Did you put that in a script, or did you rewrite the showQueries function? It has to be in the scope of a class since you refer to $this, so if its not in a function it'll throw an error since you cannot access $this.
I did biff this logic though. Return by references must be variables, not strings. So simply return the member:
There is a downside to returning by reference though; you can rewrite a private member value this was as well since the $var in my example would refer to $this->queriesRun.