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
F18857947: D12420.id30873.diff
Sat, Nov 1, 7:07 PM
F18809954: D12420.id30871.diff
Sun, Oct 19, 6:25 PM
F18769395: D12420.id.diff
Wed, Oct 8, 7:28 AM
F18673048: D12420.diff
Sep 25 2025, 9:09 AM
F18429103: D12420.id29828.diff
Aug 31 2025, 2:29 AM
F18377814: D12420.id30873.diff
Aug 28 2025, 1:32 PM
F18377072: D12420.id30873.diff
Aug 28 2025, 12:06 PM
F18231999: D12420.diff
Aug 20 2025, 3:05 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