| @@ 1199-1209 (lines=11) @@ | ||
| 1196 | * |
|
| 1197 | * @throws InvalidArgumentException |
|
| 1198 | */ |
|
| 1199 | public static function unicodeLetters($value, $message = '') |
|
| 1200 | { |
|
| 1201 | static::string($value); |
|
| 1202 | ||
| 1203 | if (!\preg_match('/^\p{L}+$/u', $value)) { |
|
| 1204 | static::reportInvalidArgument(\sprintf( |
|
| 1205 | $message ?: 'Expected a value to contain only Unicode letters. Got: %s', |
|
| 1206 | static::valueToString($value) |
|
| 1207 | )); |
|
| 1208 | } |
|
| 1209 | } |
|
| 1210 | ||
| 1211 | /** |
|
| 1212 | * @psalm-pure |
|
| @@ 1428-1438 (lines=11) @@ | ||
| 1425 | * |
|
| 1426 | * @throws InvalidArgumentException |
|
| 1427 | */ |
|
| 1428 | public static function fileExists($value, $message = '') |
|
| 1429 | { |
|
| 1430 | static::string($value); |
|
| 1431 | ||
| 1432 | if (!\file_exists($value)) { |
|
| 1433 | static::reportInvalidArgument(\sprintf( |
|
| 1434 | $message ?: 'The file %s does not exist.', |
|
| 1435 | static::valueToString($value) |
|
| 1436 | )); |
|
| 1437 | } |
|
| 1438 | } |
|
| 1439 | ||
| 1440 | /** |
|
| 1441 | * @param mixed $value |
|