Completed
Pull Request — master (#41)
by Lars
01:31
created

KeepOriginalValueLexer::getNextToken()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 3
1
<?php
2
3
namespace Spatie\Php7to5\PhpParser;
4
5
use PhpParser\Lexer;
6
use PhpParser\Parser\Tokens;
7
8
class KeepOriginalValueLexer extends Lexer // or Lexer\Emulative
9
{
10
    public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null): int
11
    {
12
        $tokenId = parent::getNextToken($value, $startAttributes, $endAttributes);
13
14
        if ($tokenId == Tokens::T_CONSTANT_ENCAPSED_STRING) {
15
            $endAttributes['originalValue'] = '_+*-7-to-5-*+_' . $value . '_+*-7-to-5-*+_';
16
        }
17
18
        return $tokenId;
19
    }
20
}
21