Replace use of &$this
Use of &$this doesn't work in PHP 7.1. For callbacks to methods like
array_map() it's completely unnecessary, while for hooks we still need
to pass a reference and so we need to copy $this into a local variable.
(cherry picked from commit 8bfc15c729c69bf0a23977e324677732ac20baa9)