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)
Tue, May 7, 10:02 AM
Unknown Object (File)
Fri, May 3, 11:55 AM
Unknown Object (File)
Thu, Apr 25, 3:25 AM
Unknown Object (File)
Apr 1 2024, 11:53 AM
Unknown Object (File)
Mar 29 2024, 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
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 5320
Build 5338: [Placeholder Plan] Wait for 30 Seconds