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, Apr 25, 3:25 AM
Unknown Object (File)
Mon, Apr 1, 11:53 AM
Unknown Object (File)
Fri, Mar 29, 10:10 PM
Unknown Object (File)
Mar 20 2024, 2:25 PM
Unknown Object (File)
Feb 15 2024, 2:10 PM
Unknown Object (File)
Feb 15 2024, 2:10 PM
Unknown Object (File)
Feb 15 2024, 2:10 PM
Unknown Object (File)
Feb 15 2024, 2:04 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