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
ParameterElementTypeException
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
 getElementType
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 element 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 ParameterElementTypeException extends ParameterAssertionException {
17
18    private string $elementType;
19
20    public function __construct( string $parameterName, string $elementType ) {
21        parent::__construct( $parameterName, "all elements must be $elementType" );
22
23        $this->elementType = $elementType;
24    }
25
26    public function getElementType(): string {
27        return $this->elementType;
28    }
29
30}