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