]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Minor improvement to self member reference linter rule
authorJoshua Spence <josh@joshuaspence.com>
Mon, 13 Apr 2015 20:29:58 +0000 (06:29 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Mon, 13 Apr 2015 20:29:58 +0000 (06:29 +1000)
Summary: Ref T7409. If `::` is surrounded by whitespace tokens and the whitespace token contains a newline character, allow it.

Test Plan: Added test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12391

src/lint/linter/ArcanistXHPASTLinter.php
src/lint/linter/__tests__/xhpast/self-member-references.lint-test

index 405530fff02545078c6c545c9a2fd31b7ba00b98..53999b44a66f4b229dd63bf2b8d3fccc23568470 100644 (file)
@@ -3459,6 +3459,10 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
 
       foreach ($tokens as $token) {
         if ($token->isAnyWhitespace()) {
+          if (strpos($token->getValue(), "\n") !== false) {
+            continue;
+          }
+
           $this->raiseLintAtToken(
             $token,
             self::LINT_SELF_MEMBER_REFERENCE,
index c4c1a9c64d84824808506256175141ae02963356..5974218a0787e1b0dcca8c9db7d256689aca7fe7 100644 (file)
@@ -21,6 +21,9 @@ class Foo extends Bar {
 }
 
 MyClass :: myMethod();
+
+SomeReallyLongClassName
+  ::someMethod();
 ~~~~~~~~~~
 error:3:7
 advice:7:5
@@ -54,3 +57,6 @@ class Foo extends Bar {
 }
 
 MyClass::myMethod();
+
+SomeReallyLongClassName
+  ::someMethod();