RequestOptions::validateTimeout( float|null $value, string $fieldName )

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

Validates timeout values.

Parameters

$valuefloat|nullrequired
Timeout to validate.
$fieldNamestringrequired
Field name for the error message.

Source

private function validateTimeout(?float $value, string $fieldName): void
{
    if ($value !== null && $value < 0) {
        throw new InvalidArgumentException(sprintf('Request option "%s" must be greater than or equal to 0.', $fieldName));
    }
}

Changelog

VersionDescription
0.2.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.