Merge "maintenance: Script to rename titles for Unicode uppercasing changes"
[lhc/web/wiklou.git] / includes / libs / services / ServiceAlreadyDefinedException.php
1 <?php
2
3 namespace Wikimedia\Services;
4
5 use Exception;
6 use Psr\Container\ContainerExceptionInterface;
7 use RuntimeException;
8
9 /**
10 * Exception thrown when a service was already defined, but the
11 * caller expected it to not exist.
12 *
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.
17 *
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.
22 *
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
27 *
28 * @file
29 *
30 * @since 1.27
31 */
32
33 /**
34 * Exception thrown when a service was already defined, but the
35 * caller expected it to not exist.
36 */
37 class ServiceAlreadyDefinedException extends RuntimeException
38 implements ContainerExceptionInterface {
39
40 /**
41 * @param string $serviceName
42 * @param Exception|null $previous
43 */
44 public function __construct( $serviceName, Exception $previous = null ) {
45 parent::__construct( "Service already defined: $serviceName", 0, $previous );
46 }
47
48 }
49
50 /**
51 * Retain the old class name for backwards compatibility.
52 * @deprecated since 1.33
53 */
54 class_alias( ServiceAlreadyDefinedException::class,
55 'MediaWiki\Services\ServiceAlreadyDefinedException' );