Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistSpellingLinter.php
Context not available. | |||||
private function checkPartialWord($path, $word, $correction) { | private function checkPartialWord($path, $word, $correction) { | ||||
$text = $this->getData($path); | $text = $this->getData($path); | ||||
$pos = 0; | $pos = 0; | ||||
while ($pos < strlen($text)) { | while ($pos < @strlen($text)) { | ||||
$next = stripos($text, $word, $pos); | $next = stripos($text, $word, $pos); | ||||
if ($next === false) { | if ($next === false) { | ||||
return; | return; | ||||
} | } | ||||
$original = substr($text, $next, strlen($word)); | $original = @substr($text, $next, @strlen($word)); | ||||
$replacement = self::fixLetterCase($correction, $original); | $replacement = self::fixLetterCase($correction, $original); | ||||
$this->raiseLintAtOffset( | $this->raiseLintAtOffset( | ||||
$next, | $next, | ||||
Context not available. | |||||
public static function fixLetterCase($string, $case) { | public static function fixLetterCase($string, $case) { | ||||
switch ($case) { | switch ($case) { | ||||
case strtolower($case): | case @strtolower($case): | ||||
return strtolower($string); | return @strtolower($string); | ||||
case strtoupper($case): | case strtoupper($case): | ||||
return strtoupper($string); | return strtoupper($string); | ||||
case ucwords(strtolower($case)): | case ucwords(@strtolower($case)): | ||||
return ucwords(strtolower($string)); | return ucwords(@strtolower($string)); | ||||
default: | default: | ||||
return null; | return null; | ||||
} | } | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0