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)
Sat, Dec 21, 6:39 AM
Unknown Object (File)
Thu, Dec 19, 2:59 PM
Unknown Object (File)
Tue, Dec 10, 12:23 AM
Unknown Object (File)
Fri, Dec 6, 11:03 PM
Unknown Object (File)
Fri, Dec 6, 4:36 AM
Unknown Object (File)
Tue, Dec 3, 7:29 AM
Unknown Object (File)
Nov 22 2024, 7:19 PM
Unknown Object (File)
Nov 22 2024, 11:50 AM
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
Branch
master
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 5969
Build 5989: [Placeholder Plan] Wait for 30 Seconds