<commit_before>perf typing
============

Typing package from perf, the PHP Extensible and Robust Framework.

Validates a variable against a type specification (as the ones in PHPDoc blocks), like the following:
- integer
- mixed
- string
- string[]
- resource
- {string:float}
- etc.

## Usage

### Static validation with exceptions

```php
<?php

use perf\Typing\Type;

// Valid, will not throw an exception.
Type::mustBe('string', 'foo');

// Invalid, will throw an exception.
Type::mustBe('string', 123);
```<commit_msg>updated README.md with more advanced examples.<commit_after>perf typing
============

Typing package from perf, the PHP Extensible and Robust Framework.

Validates a variable against a type specification (as the ones in PHPDoc blocks), like the following:
- integer
- scalar
- mixed
- string
- float[]
- int[][]
- {string:float}
- {int:\My\Stuff}
- {int:string}[]
- resource
- int|string
- {string:{int:\My\Stuff|int[]}}[]
- etc.

## Usage

### Static validation with exceptions

```php
<?php

use perf\Typing\Type;

// Valid, will not throw an exception.
Type::mustBe('string', 'foo');

// Invalid, will throw an exception.
Type::mustBe('string', 123);
```
{'fraction_non_alphanumeric': 0.15932203389830507, 'fraction_numerical': 0.005084745762711864, 'mean_word_length': 4.31981981981982, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1478038', 'n_tokens_mistral': 380, 'n_tokens_neox': 359, 'n_words': 129}