<commit_before># Phpparser

The Phpparser task will run static code analyses on your PHP code.
You can specify which code visitors should run on your code or write your own code visitor.
 
 ***Composer***
 
 ```
 composer require --dev nikic/php-parser
 ```
 
 ***Config***
 
The task lives under the `php_parser` namespace and has following configurable parameters:

```yaml
# grumphp.yml
parameters:
    tasks:
        phpparser:
            ignore_patterns: []
            kind: php7
            triggered_by: [php]
            visitors: {}
```

**triggered_by**

*Default: [php]*

This option will specify which file extensions will trigger the php blacklist task.
By default php blacklist will be triggered by altering a php file.
You can overwrite this option to whatever filetype you want to validate!

**ignore_patterns**

*Default: []*

This is a list of patterns that will be ignored by the PHP Parser.
With this option you can skip files like tests. Leave this option blank to run analysis for every php file.

**kind**

*Default: php7*

Can be one of: php5, php7.
This option determines which Lexer the PHP_Parser uses to tokenize the PHP code.
By default the PREFER_PHP7 is loaded.

**visitors**

*Default: {}*

Use this parameter to specify what code you want to scan. This is made possible by node visitors following PHP_Parser syntax.
Without any visitors specified, PHP Parser will only check code syntax (similar to php lint).
In the next chapter, you can find a list of built-in visitors. 
It's also possible to write your own visitor!


## Built-in visitors

- [declare_strict_types](#declare_strict_types)
- [forbidden_class_method_calls](#forbidden_class_method_calls)
- [forbidden_function_calls](#forbidden_function_calls)
- [forbidden_static_method_calls](#forbidden_static_method_calls)
- [nameresolver](#nameresolver)
- [never_use_else](#never_use_else)<commit_msg>Updated phpparser.md<commit_after># Phpparser

The Phpparser task will run static code analyses on your PHP code.
You can specify which code visitors should run on your code or write your own code visitor.
 
 ***Composer***
 
 ```
 composer require --dev nikic/php-parser
 ```
 
 ***Config***
 
The task lives under the `php_parser` namespace and has following configurable parameters:

```yaml
# grumphp.yml
parameters:
    tasks:
        phpparser:
            ignore_patterns: []
            kind: php7
            visitors: {}
            triggered_by: [php]
```

**ignore_patterns**

*Default: []*

This is a list of patterns that will be ignored by the PHP Parser.
With this option you can skip files like tests. Leave this option blank to run analysis for every php file.

**kind**

*Default: php7*

Can be one of: php5, php7.
This option determines which Lexer the PHP_Parser uses to tokenize the PHP code.
By default the PREFER_PHP7 is loaded.

**visitors**

*Default: {}*

Use this parameter to specify what code you want to scan. This is made possible by node visitors following PHP_Parser syntax.
Without any visitors specified, PHP Parser will only check code syntax (similar to php lint).
In the next chapter, you can find a list of built-in visitors. 
It's also possible to write your own visitor!

**triggered_by**

*Default: [php]*

This option will specify which file extensions will trigger the php blacklist task.
By default php blacklist will be triggered by altering a php file.
You can overwrite this option to whatever filetype you want to validate!

## Built-in visitors

- [declare_strict_types](#declare_strict_types)
- [forbidden_class_method_calls](#forbidden_class_method_calls)
- [forbidden_function_calls](#forbidden_function_calls)
- [forbidden_static_method_calls](#forbidden_static_method_calls)
- [nameresolver](#nameresolver)
- [never_use_else](#never_use_else)
{'fraction_non_alphanumeric': 0.07783641160949868, 'fraction_numerical': 0.002638522427440633, 'mean_word_length': 4.2217630853994494, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '622814', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1080, 'n_words': 460}