| 1 | <?php |
||
| 21 | class Scss extends PreProcessor |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * Tokenization rules |
||
| 25 | * |
||
| 26 | * @return \Kadet\Highlighter\Parser\Rule[]|\Kadet\Highlighter\Parser\Rule[][] |
||
| 27 | */ |
||
| 28 | public function setupRules() |
||
| 29 | { |
||
| 30 | parent::setupRules(); |
||
| 31 | |||
| 32 | $this->rules->remove('symbol.selector.tag'); |
||
|
1 ignored issue
–
show
|
|||
| 33 | $this->rules->add('symbol.selector.tag', new Rule(new RegexMatcher('/(?>[\s{};]|^)(?=(\w+)[^;]*\{)/m'), [ |
||
| 34 | 'context' => ['!symbol', '!string', '!number'] |
||
| 35 | ])); |
||
| 36 | |||
| 37 | $this->rules->add('variable', new Rule(new RegexMatcher('/(\$[\w-]+)/'), ['context' => $this->everywhere()])); |
||
| 38 | } |
||
| 39 | |||
| 40 | public function getIdentifier() |
||
| 44 | } |
||
| 45 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call: