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
ParameterKeyTypeException
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
 getType
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 key type assertion failed.
8 * This generally means a disagreement between the caller and the implementation of a function.
9 *
10 * @since 0.3.0
11 *
12 * @license MIT
13 * @author Daniel Kinzler
14 * @author Thiemo Kreuz
15 * @copyright Wikimedia Deutschland e.V.
16 */
17class ParameterKeyTypeException extends ParameterAssertionException {
18
19    private string $type;
20
21    public function __construct( string $parameterName, string $type ) {
22        parent::__construct( $parameterName, "all elements must have $type keys" );
23
24        $this->type = $type;
25    }
26
27    public function getType(): string {
28        return $this->type;
29    }
30
31}