| @@ 1341-1351 (lines=11) @@ | ||
| 1338 | * |
|
| 1339 | * @throws InvalidArgumentException |
|
| 1340 | */ |
|
| 1341 | public static function unicodeLetters($value, $message = '') |
|
| 1342 | { |
|
| 1343 | static::string($value); |
|
| 1344 | ||
| 1345 | if (!\preg_match('/^\p{L}+$/u', $value)) { |
|
| 1346 | static::reportInvalidArgument(\sprintf( |
|
| 1347 | $message ?: 'Expected a value to contain only Unicode letters. Got: %s', |
|
| 1348 | static::valueToString($value) |
|
| 1349 | )); |
|
| 1350 | } |
|
| 1351 | } |
|
| 1352 | ||
| 1353 | /** |
|
| 1354 | * @psalm-pure |
|
| @@ 1570-1580 (lines=11) @@ | ||
| 1567 | * |
|
| 1568 | * @throws InvalidArgumentException |
|
| 1569 | */ |
|
| 1570 | public static function fileExists($value, $message = '') |
|
| 1571 | { |
|
| 1572 | static::string($value); |
|
| 1573 | ||
| 1574 | if (!\file_exists($value)) { |
|
| 1575 | static::reportInvalidArgument(\sprintf( |
|
| 1576 | $message ?: 'The file %s does not exist.', |
|
| 1577 | static::valueToString($value) |
|
| 1578 | )); |
|
| 1579 | } |
|
| 1580 | } |
|
| 1581 | ||
| 1582 | /** |
|
| 1583 | * @param mixed $value |
|