]> khamidou — GitHub mirrors - arcanist.git/commit
Fix self member reference rule for PHP 5.3
authorJoshua Spence <josh@joshuaspence.com>
Mon, 10 Aug 2015 20:49:54 +0000 (06:49 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Mon, 10 Aug 2015 20:49:55 +0000 (06:49 +1000)
commit587f7440e3f9fc164f6969ca8dc008231d6c07aa
tree96e273e7c5eaf5a532a0298904202f4c017127f3
parent6c759ae34396a96b3ec94a269f0fe635a4a47879
Fix self member reference rule for PHP 5.3

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 [[http://php.net/manual/en/functions.anonymous.php | 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.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T8674

Differential Revision: https://secure.phabricator.com/D13820
src/lint/linter/ArcanistXHPASTLinter.php
src/lint/linter/__tests__/xhpast/self-member-references-php53.lint-test [new file with mode: 0644]
src/lint/linter/__tests__/xhpast/self-member-references-php54.lint-test [new file with mode: 0644]
src/lint/linter/xhpast/ArcanistXHPASTLinterRule.php
src/lint/linter/xhpast/rules/ArcanistPHPCompatibilityXHPASTLinterRule.php
src/lint/linter/xhpast/rules/ArcanistSelfMemberReferenceXHPASTLinterRule.php