3 * This file is part of PHPUnit.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
12 * Factory for PHPUnit_Framework_Exception objects that are used to describe
13 * invalid arguments passed to a function or method.
15 * @since Class available since Release 3.4.0
17 class PHPUnit_Util_InvalidArgumentHelper
20 * @param int $argument
24 * @return PHPUnit_Framework_Exception
26 public static function factory($argument, $type, $value = null)
28 $stack = debug_backtrace(false);
30 return new PHPUnit_Framework_Exception(
32 'Argument #%d%sof %s::%s() must be a %s',
34 $value !== null ? ' (' . gettype($value) . '#' . $value . ')' : ' (No Value) ',
36 $stack[1]['function'],