blob: 943f6c08ca207d1abd2372a3038b01742a3bac61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<?php
namespace Wikimedia\Assert;
/**
* Exception indicating that a parameter type assertion failed.
* This generally means a disagreement between the caller and the implementation of a function.
*
* @license MIT
* @author Daniel Kinzler
* @copyright Wikimedia Deutschland e.V.
*/
class ParameterTypeException extends ParameterAssertionException {
/**
* @var string
*/
private $parameterType;
/**
* @param string $parameterName
* @param string $parameterType
*
* @throws ParameterTypeException
*/
public function __construct( $parameterName, $parameterType ) {
if ( !is_string( $parameterType ) ) {
throw new ParameterTypeException( 'parameterType', 'string' );
}
parent::__construct( $parameterName, "must be a $parameterType" );
$this->parameterType = $parameterType;
}
/**
* @return string
*/
public function getParameterType() {
return $this->parameterType;
}
}
|