Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ServiceAlreadyDefinedException
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2declare( strict_types = 1 );
3
4/**
5 * Exception thrown when a service was already defined, but the
6 * caller expected it to not exist.
7 *
8 * @license GPL-2.0-or-later
9 * @file
10 */
11
12namespace Wikimedia\Services;
13
14use Exception;
15use Psr\Container\ContainerExceptionInterface;
16use RuntimeException;
17
18/**
19 * Exception thrown when a service was already defined, but the
20 * caller expected it to not exist.
21 */
22class ServiceAlreadyDefinedException extends RuntimeException
23    implements ContainerExceptionInterface {
24
25    /**
26     * @param string $serviceName
27     * @param Exception|null $previous
28     */
29    public function __construct( string $serviceName, ?Exception $previous = null ) {
30        parent::__construct( "Service already defined: $serviceName", 0, $previous );
31    }
32
33}