final class Utf8

Reads UTF-8 scalar encodings, including the ASCII and three-byte subsets.

Methods§

public function valid(string $bytes, int $maximumWidth = 4): bool

Rejects truncation, isolated continuation bytes, overlong forms, surrogates and out-of-range scalars.

Parameters

$bytesstring
$maximumWidthint

Returns

bool
Test cases 32
Called from 3
Calls 3
public function width(int<0, 255> $lead): int

Classifies a UTF-8 leading byte; zero denotes an invalid lead or a continuation byte.

Parameters

$leadint<0, 255>

Returns

int
Test cases 29
Called from 1

Test cases 43§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 33
Other tests reaching this symbol 10

Relations§

Instantiated in 3
Method calls 3