Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
UnexpectedQueryResponseException
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 withExpectedType
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3// ╔════════════════════════════════════════════════════════════╗
4// ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║
5// ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com>     ║
6// ╚════════════════════════════════════════════════════════════╝
7
8declare(strict_types=1);
9
10namespace Phexium\Plugin\QueryBus\Port\Exception;
11
12use Phexium\Application\Query\QueryResponseInterface;
13use RuntimeException;
14
15final class UnexpectedQueryResponseException extends RuntimeException
16{
17    public static function withExpectedType(string $expectedClass, QueryResponseInterface $actualResponse): self
18    {
19        return new self(sprintf(
20            'Expected %s from the query bus, got %s.',
21            $expectedClass,
22            $actualResponse::class,
23        ));
24    }
25}