Skip to content

Commit

Permalink
Variable $this must be lowercase, PHP is case sensitive for variables
Browse files Browse the repository at this point in the history
  • Loading branch information
michalbundyra committed Jan 6, 2020
1 parent 0a6c51e commit 6c9b326
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Standards/Squiz/Sniffs/Scope/StaticThisUsageSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
} else if ($tokens[$next]['code'] === T_ANON_CLASS) {
$next = $tokens[$next]['scope_closer'];
continue;
} else if (strtolower($tokens[$next]['content']) !== '$this') {
} else if ($tokens[$next]['content'] !== '$this') {
continue;
}

Expand Down
6 changes: 6 additions & 0 deletions src/Standards/Squiz/Tests/Scope/StaticThisUsageUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,10 @@ $b = new class()
}) {
};
}

public static function thisMustBeLowercase() {
$This = 'hey';

return $This;
}
}

0 comments on commit 6c9b326

Please sign in to comment.