Fixes #791: `$this` was used in anonymous context