Skip to content

Commit 6c9b326

Browse files
committed
Variable $this must be lowercase, PHP is case sensitive for variables
1 parent 0a6c51e commit 6c9b326

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Standards/Squiz/Sniffs/Scope/StaticThisUsageSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
7575
} else if ($tokens[$next]['code'] === T_ANON_CLASS) {
7676
$next = $tokens[$next]['scope_closer'];
7777
continue;
78-
} else if (strtolower($tokens[$next]['content']) !== '$this') {
78+
} else if ($tokens[$next]['content'] !== '$this') {
7979
continue;
8080
}
8181

src/Standards/Squiz/Tests/Scope/StaticThisUsageUnitTest.inc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,10 @@ $b = new class()
108108
}) {
109109
};
110110
}
111+
112+
public static function thisMustBeLowercase() {
113+
$This = 'hey';
114+
115+
return $This;
116+
}
111117
}

0 commit comments

Comments
 (0)