Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
ParameterTypeException
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getParameterType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2declare( strict_types = 1 );
3
4namespace Wikimedia\Assert;
5
6/**
7 * Exception indicating that a parameter type assertion failed.
8 * This generally means a disagreement between the caller and the implementation of a function.
9 *
10 * @since 0.1.0
11 *
12 * @license MIT
13 * @author Daniel Kinzler
14 * @copyright Wikimedia Deutschland e.V.
15 */
16class ParameterTypeException extends ParameterAssertionException {
17
18    private string $parameterType;
19
20    public function __construct( string $parameterName, string $parameterType ) {
21        parent::__construct( $parameterName, "must be a $parameterType" );
22
23        $this->parameterType = $parameterType;
24    }
25
26    public function getParameterType(): string {
27        return $this->parameterType;
28    }
29
30}