Conditions | 6 |
Paths | 6 |
Total Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
57 | public function process(File $file, $position): void |
||
58 | { |
||
59 | $tokens = $file->getTokens(); |
||
60 | $token = $tokens[$position]; |
||
61 | |||
62 | if ($token['type'] === 'T_USE') { |
||
63 | $count = 0; |
||
64 | |||
65 | for ($i = $position; $i <= $file->findEndOfStatement($position, [T_COMMA]); $i++) { |
||
66 | if ($tokens[$i]['type'] === 'T_NS_SEPARATOR') { |
||
67 | $count++; |
||
68 | } |
||
69 | } |
||
70 | |||
71 | $this->nsSeperatorCount -= $count; |
||
72 | } elseif ($token['type'] === 'T_NS_SEPARATOR') { |
||
73 | $this->nsSeperatorCount++; |
||
74 | } |
||
75 | |||
76 | if($this->nsSeperatorCount > 0){ |
||
77 | $file->addError( |
||
78 | self::ERROR_FQN_NOT_ALLOWED, |
||
79 | $position, |
||
80 | self::CODE_FQN_FOUND |
||
81 | ); |
||
82 | } |
||
83 | } |
||
84 | } |
||
85 |