| Conditions | 1 |
| Paths | 1 |
| Total Lines | 36 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | public function setupRules() |
||
| 34 | { |
||
| 35 | parent::setupRules(); |
||
| 36 | |||
| 37 | $this->rules->remove('meta.selector'); |
||
|
1 ignored issue
–
show
|
|||
| 38 | $this->rules->remove('meta.declaration'); |
||
|
1 ignored issue
–
show
|
|||
| 39 | $this->rules->remove('meta.declaration.media'); |
||
|
1 ignored issue
–
show
|
|||
| 40 | $this->rules->remove('meta.selector.tag'); |
||
|
1 ignored issue
–
show
|
|||
| 41 | |||
| 42 | $this->rules->add('meta.selector', new Rule(new RegexMatcher('/(?=(?:\n+|^)(\h*)([^\h].*)\n+\1\h+)/', [ |
||
| 43 | 2 => Token::NAME |
||
| 44 | ]), [ |
||
| 45 | 'context' => Validator::everywhere(), |
||
| 46 | 'priority' => 3, |
||
| 47 | 'factory' => new TokenFactory(MetaToken::class) |
||
| 48 | ])); |
||
| 49 | |||
| 50 | $this->rules->add('meta.declaration', new Rule(new RegexMatcher('/\n((?:\h+.*?(?>\n|$)+)+)/'), [ |
||
| 51 | 'context' => Validator::everywhere(), |
||
| 52 | 'priority' => 2, |
||
| 53 | 'factory' => new TokenFactory(MetaToken::class) |
||
| 54 | ])); |
||
| 55 | |||
| 56 | $this->rules->add('meta.declaration.media', new Rule(new RegexMatcher('/@media(.*?)/'), [ |
||
| 57 | 'context' => Validator::everywhere(), |
||
| 58 | 'factory' => new TokenFactory(MetaToken::class) |
||
| 59 | ])); |
||
| 60 | |||
| 61 | $this->rules->add('symbol.selector.tag', new Rule(new RegexMatcher('/([\w-]+)/'), [ |
||
| 62 | 'context' => ['meta.selector', '!symbol', '!meta.declaration.media'], |
||
| 63 | ])); |
||
| 64 | |||
| 65 | $this->rules->rule('symbol.selector.class')->setContext(['meta.selector']); |
||
| 66 | $this->rules->rule('symbol.selector.class.pseudo')->setContext(['meta.selector']); |
||
| 67 | $this->rules->rule('symbol.selector.id')->setContext(['meta.selector']); |
||
| 68 | } |
||
| 69 | |||
| 75 |
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: