Under-the-hood PHPStan
1. What Does int-mask-of<CONSTNAME_*> Mean?
The integer is a bitmask composed of one or more JSON_*
constants.
#Example
/**
* Encodes data to JSON with customizable flags.
*
* @param array $data The data to encode.
* @param `int-mask-of<JSON_*>` $flags Bitmask of `JSON_*` constants.
* @return string The JSON-encoded string.
*/
function encodeJson(array $data, int $flags): string {
return json_encode($data, $flags);
}
// Usage
$data = ['name' => 'Alice', 'age' => 30];
$json = encodeJson($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
## 2. ignoreErrors in phpstan config file
#Example
```html
parameters:
ignoreErrors:
- identifier: trait.unused