Page MenuHomePhabricator

ArcanistClassNameLiteralXHPASTLinterRule can produce incorrect results
Closed, ResolvedPublic

Description

On PHP 5.3, it is not possible to use self within a closure. As such, the patch suggested by ArcanistClassNameLiteralXHPASTLinterRule can be incorrect:

<?php

class SomeClass {
  public static function someMethod() {
    $closure = function() {
      SomeClass::someOtherMethod();
    };
    $closure();
  }

  public static function someOtherMethod() {
    echo __METHOD__."\n";
  }
}
<?php

class SomeClass {
  public static function someMethod() {
    $closure = function() {
      self::someOtherMethod();
    };
    $closure();
  }

  public static function someOtherMethod() {
    echo __METHOD__."\n";
  }
}

Revisions and Commits

Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

joshuaspence raised the priority of this task from to Needs Triage.
joshuaspence updated the task description. (Show Details)
joshuaspence added a project: Lint.
joshuaspence added a subscriber: joshuaspence.
joshuaspence added a revision: Restricted Differential Revision.Aug 7 2015, 3:59 AM
joshuaspence added a revision: Restricted Differential Revision.Aug 7 2015, 4:21 AM
joshuaspence added a commit: Restricted Diffusion Commit.Aug 9 2015, 10:27 PM
joshuaspence added a revision: Restricted Differential Revision.Aug 10 2015, 10:06 AM
joshuaspence closed this task as Resolved by committing Restricted Diffusion Commit.Aug 10 2015, 8:49 PM
joshuaspence added a commit: Restricted Diffusion Commit.
joshuaspence added a commit: Restricted Diffusion Commit.