]> khamidou — GitHub mirrors - arcanist.git/commit
Add a linter rule for incorrect use of parent scope
authorJoshua Spence <josh@joshuaspence.com>
Thu, 14 May 2015 08:01:43 +0000 (18:01 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Thu, 14 May 2015 08:05:14 +0000 (18:05 +1000)
commitf00d4219ddab116c29b929a2dc93802f60ea9900
tree99f81aa4e5592a68ac4369585c59ef22ed7a44b7
parenta6a26bb3a30ab0f7270dee4b9355a5c3f2fb090f
Add a linter rule for incorrect use of parent scope

Summary:
The following code is invalid:

```
final class MyClass {
  public function __construct() {
    parent::__construct(null);
  }
}

$x = new MyClass();
```

Running the above code will produce a fatal error:

```
PHP Fatal error:  Cannot access parent:: when current class scope has no parent
```

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12420
src/lint/linter/ArcanistXHPASTLinter.php
src/lint/linter/__tests__/xhpast/no-parent-scope.lint-test [new file with mode: 0644]