1
0
mirror of https://github.com/danog/amp.git synced 2024-12-02 09:27:46 +01:00

Remove unused createTypeError

This commit is contained in:
Niklas Keller 2022-11-06 22:16:33 +01:00
parent c4ca585ce4
commit 46890fed24
No known key found for this signature in database
GPG Key ID: AFA536ABA90C76A6

View File

@ -30,27 +30,6 @@ function formatStacktrace(array $trace): string
}, $trace, \array_keys($trace)));
}
/**
* Creates a `TypeError` with a standardized error message.
*
* @param string[] $expected Expected types.
* @param mixed $given Given value.
*
* @internal
*/
function createTypeError(array $expected, mixed $given): \TypeError
{
$givenType = \is_object($given) ? \sprintf("instance of %s", \get_class($given)) : \gettype($given);
if (\count($expected) === 1) {
$expectedType = "Expected the following type: " . \array_pop($expected);
} else {
$expectedType = "Expected one of the following types: " . \implode(", ", $expected);
}
return new \TypeError("{$expectedType}; {$givenType} given");
}
/**
* @return bool True if AMP_DEBUG is set to a truthy value.
*/