annotate vendor/phpunit/php-code-coverage/src/CodeCoverage/Util/InvalidArgumentHelper.php @ 7:848c88cfe644

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