Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| NoWhitespace | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
| generateMatches | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * @file |
| 4 | * @license https://opensource.org/licenses/Apache-2.0 Apache-2.0 |
| 5 | */ |
| 6 | |
| 7 | namespace Wikimedia\CSS\Grammar; |
| 8 | |
| 9 | use Wikimedia\CSS\Objects\ComponentValueList; |
| 10 | use Wikimedia\CSS\Objects\Token; |
| 11 | |
| 12 | /** |
| 13 | * Matcher that asserts there was no whitespace before the current position. |
| 14 | */ |
| 15 | class NoWhitespace extends Matcher { |
| 16 | |
| 17 | /** @inheritDoc */ |
| 18 | protected function generateMatches( ComponentValueList $values, $start, array $options ) { |
| 19 | $cv = $values[$start - 1] ?? null; |
| 20 | if ( !$cv instanceof Token || $cv->type() !== Token::T_WHITESPACE ) { |
| 21 | yield $this->makeMatch( $values, $start, $start ); |
| 22 | } |
| 23 | } |
| 24 | } |