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.
17
* @author Sebastian Bergmann <sebastian@phpunit.de>
18
* @copyright Sebastian Bergmann <sebastian@phpunit.de>
19
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
20
* @link http://www.phpunit.de/
21
* @since Class available since Release 3.4.0
23
class PHPUnit_Util_InvalidArgumentHelper
26
* @param integer $argument
29
* @return PHPUnit_Framework_Exception
31
public static function factory($argument, $type, $value = null)
33
$stack = debug_backtrace(false);
35
return new PHPUnit_Framework_Exception(
37
'Argument #%d%sof %s::%s() must be a %s',
39
$value !== null ? ' (' . gettype($value) . '#' . $value . ')' : ' (No Value) ',
41
$stack[1]['function'],