Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Assert.php

function Assert::startsWithLetter

@psalm-pure

Parameters

mixed $value:

string $message:

Throws

InvalidArgumentException

File

vendor/webmozart/assert/src/Assert.php, line 1089

Class

Assert
Efficient assertions to validate the input/output of your methods.

Namespace

Webmozart\Assert

Code

public static function startsWithLetter($value, $message = '') {
    static::string($value);
    $valid = isset($value[0]);
    if ($valid) {
        $locale = \setlocale(LC_CTYPE, 0);
        \setlocale(LC_CTYPE, 'C');
        $valid = \ctype_alpha($value[0]);
        \setlocale(LC_CTYPE, $locale);
    }
    if (!$valid) {
        static::reportInvalidArgument(\sprintf($message ?: 'Expected a value to start with a letter. Got: %s', static::valueToString($value)));
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal