comparison vendor/phpunit/php-code-coverage/src/CodeCoverage/Util/InvalidArgumentHelper.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2 /*
3 * This file is part of the PHP_CodeCoverage package.
4 *
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11 /**
12 * Factory for PHP_CodeCoverage_Exception objects that are used to describe
13 * invalid arguments passed to a function or method.
14 *
15 * @since Class available since Release 1.2.0
16 */
17 class PHP_CodeCoverage_Util_InvalidArgumentHelper
18 {
19 /**
20 * @param int $argument
21 * @param string $type
22 * @param mixed $value
23 */
24 public static function factory($argument, $type, $value = null)
25 {
26 $stack = debug_backtrace(false);
27
28 return new PHP_CodeCoverage_Exception(
29 sprintf(
30 'Argument #%d%sof %s::%s() must be a %s',
31 $argument,
32 $value !== null ? ' (' . gettype($value) . '#' . $value . ')' : ' (No Value) ',
33 $stack[1]['class'],
34 $stack[1]['function'],
35 $type
36 )
37 );
38 }
39 }