|
@@ 18-28 (lines=11) @@
|
| 15 |
|
final class PositionFinder |
| 16 |
|
{ |
| 17 |
|
|
| 18 |
|
public static function findFirstPositionInCurrentLine(PHP_CodeSniffer_File $file, int $position) : int |
| 19 |
|
{ |
| 20 |
|
$currentPosition = $position; |
| 21 |
|
|
| 22 |
|
$line = $file->getTokens()[$position]['line']; |
| 23 |
|
while ($file->getTokens()[$currentPosition]['line'] === $line) { |
| 24 |
|
$currentPosition--; |
| 25 |
|
} |
| 26 |
|
|
| 27 |
|
return $currentPosition; |
| 28 |
|
} |
| 29 |
|
|
| 30 |
|
|
| 31 |
|
public static function findLastPositionInCurrentLine(PHP_CodeSniffer_File $file, int $position) : int |
|
@@ 31-41 (lines=11) @@
|
| 28 |
|
} |
| 29 |
|
|
| 30 |
|
|
| 31 |
|
public static function findLastPositionInCurrentLine(PHP_CodeSniffer_File $file, int $position) : int |
| 32 |
|
{ |
| 33 |
|
$currentPosition = $position; |
| 34 |
|
|
| 35 |
|
$line = $file->getTokens()[$position]['line']; |
| 36 |
|
while ($file->getTokens()[$currentPosition]['line'] === $line) { |
| 37 |
|
$currentPosition++; |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
return $currentPosition; |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
} |
| 44 |
|
|