3 namespace Wikimedia\Assert;
6 * Exception indicating that a parameter type assertion failed.
7 * This generally means a disagreement between the caller and the implementation of a function.
10 * @author Daniel Kinzler
11 * @copyright Wikimedia Deutschland e.V.
13 class ParameterTypeException extends ParameterAssertionException {
18 private $parameterType;
21 * @param string $parameterName
22 * @param string $parameterType
24 * @throws ParameterTypeException
26 public function __construct( $parameterName, $parameterType ) {
27 if ( !is_string( $parameterType ) ) {
28 throw new ParameterTypeException( 'parameterType', 'string' );
31 parent::__construct( $parameterName, "must be a $parameterType" );
33 $this->parameterType = $parameterType;
39 public function getParameterType() {
40 return $this->parameterType;