Page MenuHomePhabricator

Add a linter rule for incorrect use of parent scope
ClosedPublic

Authored by joshuaspence on Apr 15 2015, 10:56 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 9, 9:00 PM
Unknown Object (File)
Tue, Dec 31, 3:22 AM
Unknown Object (File)
Mon, Dec 30, 4:32 PM
Unknown Object (File)
Tue, Dec 24, 4:47 PM
Unknown Object (File)
Sat, Dec 21, 6:39 AM
Unknown Object (File)
Thu, Dec 19, 2:59 PM
Unknown Object (File)
Dec 10 2024, 12:23 AM
Unknown Object (File)
Dec 6 2024, 11:03 PM
Subscribers

Details

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.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable