ForbiddenThisUseContexts: allow for array access by jrfnl · Pull Request #781 · PHPCompatibility/PHPCompatibility

@jrfnl

For classes which implement the `ArrayAccess` interface, such as the `ArrayObject` class, using `$this['key']` is a perfectly fine, working syntax and unsetting an item in the object using that syntax will still work and is unaffected by the changes in PHP 7.1.

The sniff, however, would throw a false positive for this.

This PR fixes that.

Includes unit tests.

Fixes 780

@jrfnl jrfnl mentioned this pull request

Dec 18, 2018

wimg

wimg approved these changes Dec 23, 2018

@wimg wimg deleted the feature/780-forbiddenthisusage-bug branch

December 23, 2018 03:30