1
0
mirror of https://github.com/danog/amp.git synced 2024-11-30 04:29:08 +01:00
amp/lib/UnionTypeError.php
2017-03-14 13:15:31 -05:00

18 lines
504 B
PHP

<?php
namespace Amp;
class UnionTypeError extends \TypeError {
/**
* @param string[] $expected Array of expected type names.
* @param mixed $given Value given.
*/
public function __construct(array $expected, $given) {
parent::__construct(\sprintf(
"Expected one of the following types: %s; %s given",
\implode(", ", $expected),
\is_object($given) ? \sprintf("instance of %s", \get_class($given)) : \gettype($given)
));
}
}