1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Yiisoft\Yii\Cycle\Exception; |
||
6 | |||
7 | use Exception; |
||
8 | |||
9 | class BadDeclarationException extends Exception |
||
10 | { |
||
11 | /** |
||
12 | * @param non-empty-string $parameter |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
13 | * @param class-string $class |
||
14 | */ |
||
15 | 24 | public function __construct(string $parameter, string $class, mixed $argument) |
|
16 | { |
||
17 | 24 | $type = \is_object($argument) |
|
18 | 9 | ? 'Instance of ' . \get_class($argument) |
|
19 | 15 | : \ucfirst(\get_debug_type($argument)); |
|
20 | 24 | parent::__construct(\sprintf( |
|
21 | 24 | '%s should be instance of %s or its declaration. %s was received instead.', |
|
22 | 24 | $parameter, |
|
23 | 24 | $class, |
|
24 | 24 | $type |
|
25 | 24 | )); |
|
26 | } |
||
27 | } |
||
28 |