Skip to content

ForbiddenThisUseContexts: allow for array access#781

Merged
wimg merged 1 commit intomasterfrom
feature/780-forbiddenthisusage-bug
Dec 23, 2018
Merged

ForbiddenThisUseContexts: allow for array access#781
wimg merged 1 commit intomasterfrom
feature/780-forbiddenthisusage-bug

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Dec 18, 2018

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

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 added Type: bug PR: quick merge PR only contains relatively simple changes PR: ready for review labels Dec 18, 2018
@jrfnl jrfnl added this to the 9.x Next milestone Dec 18, 2018
@jrfnl jrfnl requested a review from wimg December 18, 2018 20:09
@wimg wimg merged commit 9d43adb into master Dec 23, 2018
@wimg wimg deleted the feature/780-forbiddenthisusage-bug branch December 23, 2018 03:30
@jrfnl jrfnl removed the PR: quick merge PR only contains relatively simple changes label Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants