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)
Fri, Aug 21, 1:16 AM
Unknown Object (File)
Jun 30 2026, 1:34 AM
Unknown Object (File)
Jun 6 2026, 11:43 PM
Unknown Object (File)
Jan 21 2026, 8:58 PM
Unknown Object (File)
Jan 16 2026, 10:26 PM
Unknown Object (File)
Jan 15 2026, 5:22 PM
Unknown Object (File)
Nov 6 2025, 1:31 AM
Unknown Object (File)
Nov 5 2025, 11:40 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable