blob: eaaa663f65d6daee8a27486982a527622583e10a (
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 element 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 ParameterElementTypeException extends ParameterAssertionException {
/**
* @var string
*/
private $elementType;
/**
* @param string $parameterName
* @param string $elementType
*
* @throws ParameterTypeException
*/
public function __construct( $parameterName, $elementType ) {
if ( !is_string( $elementType ) ) {
throw new ParameterTypeException( 'elementType', 'string' );
}
parent::__construct( $parameterName, "all elements must be $elementType" );
$this->elementType = $elementType;
}
/**
* @return string
*/
public function getElementType() {
return $this->elementType;
}
}
|