3 namespace Wikimedia\Services
;
6 use Psr\Container\ContainerExceptionInterface
;
10 * Exception thrown when a service was already defined, but the
11 * caller expected it to not exist.
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 * http://www.gnu.org/copyleft/gpl.html
34 * Exception thrown when a service was already defined, but the
35 * caller expected it to not exist.
37 class ServiceAlreadyDefinedException
extends RuntimeException
38 implements ContainerExceptionInterface
{
41 * @param string $serviceName
42 * @param Exception|null $previous
44 public function __construct( $serviceName, Exception
$previous = null ) {
45 parent
::__construct( "Service already defined: $serviceName", 0, $previous );
51 * Retain the old class name for backwards compatibility.
52 * @deprecated since 1.33
54 class_alias( ServiceAlreadyDefinedException
::class,
55 'MediaWiki\Services\ServiceAlreadyDefinedException' );