]> khamidou — GitHub mirrors - arcanist.git/commit
Add a linter rule for `parent` references
authorJoshua Spence <josh@freelancer.com>
Wed, 18 Nov 2015 21:58:03 +0000 (08:58 +1100)
committerJoshua Spence <josh@freelancer.com>
Wed, 18 Nov 2015 21:58:03 +0000 (08:58 +1100)
commit7386afc953e0fd22b674486212a01e49ad92931d
treed4fb3f8ef4e82a040c7764027c6596b6033f49b7
parent4d512c51d43ce858b720cd4729151d55c67adb1f
Add a linter rule for `parent` references

Summary:
Add a linter rule to detect static method calls which //should// reference the `parent` class instead of a hardcoded class reference. For example, consider the following:

```lang=php, counterexample
class SomeClass extends AnotherClass {
  public function someMethod() {
    AnotherClass::someOtherMethod();
  }
}
```

This should instead be written as:

```lang=php
class SomeClass extends AnotherClass {
  public function someMethod() {
    parent::someOtherMethod();
  }
}
```

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D14443
src/__phutil_library_map__.php
src/lint/linter/xhpast/rules/ArcanistParentMemberReferenceXHPASTLinterRule.php [new file with mode: 0644]
src/lint/linter/xhpast/rules/__tests__/ArcanistParentMemberReferenceXHPASTLinterRuleTestCase.php [new file with mode: 0644]
src/lint/linter/xhpast/rules/__tests__/parent-member-references/not-parent.lint-test [new file with mode: 0644]
src/lint/linter/xhpast/rules/__tests__/parent-member-references/parent.lint-test [new file with mode: 0644]