Page MenuHomePhabricator

Fix self member reference rule for PHP 5.3
ClosedPublic

Authored by joshuaspence on Aug 7 2015, 4:21 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 1:00 AM
Unknown Object (File)
Wed, Apr 17, 3:13 PM
Unknown Object (File)
Tue, Apr 16, 5:02 AM
Unknown Object (File)
Thu, Apr 11, 6:48 AM
Unknown Object (File)
Wed, Apr 10, 5:29 PM
Unknown Object (File)
Mar 10 2024, 2:46 AM
Unknown Object (File)
Feb 19 2024, 9:06 PM
Unknown Object (File)
Jan 28 2024, 8:01 AM
Subscribers

Details

Summary

Fixes T8674. Currently, ArcanistSelfMemberReferenceXHPASTLinterRule warns if a fully-qualified class name is used in place of self. This is fine in most cases, but in some specific scenarios fails for PHP 5.3 because self (and also $this) cannot be used in an anonymous closure (see anonymous functions and [[https://wiki.php.net/rfc/closures/removal-of-this | removal of $this in closures]]).

In order to do this, I also had to modify the manner in which configuration was passed to individual linter rule. Previously, it was only possible or an individual linter rule to be set with a configuration value. Once the linter rule had set this value, there was no means by which to allow this value to be shared amongst linter rules.

Depends on D13819.

Test Plan

Added unit tests.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

joshuaspence retitled this revision from to Fix self member reference rule for PHP 5.3.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
epriestley edited edge metadata.
This revision is now accepted and ready to land.Aug 7 2015, 11:02 AM

Move the getAnonymousClosures method to ArcanistXHPASTLinterRule

This revision was automatically updated to reflect the committed changes.