1
0
mirror of https://github.com/danog/amp.git synced 2024-12-02 17:37:50 +01:00
amp/lib/UnionTypeError.php

18 lines
504 B
PHP
Raw Normal View History

2017-03-14 18:39:53 +01:00
<?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)
));
}
}