Merge "Improve return types in class MagicWordArray"
[lhc/web/wiklou.git] / includes / libs / services / CannotReplaceActiveServiceException.php
1 <?php
2
3 namespace Wikimedia\Services;
4
5 use Exception;
6 use RuntimeException;
7
8 /**
9 * Exception thrown when trying to replace an already active service.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 * http://www.gnu.org/copyleft/gpl.html
25 *
26 * @file
27 *
28 * @since 1.27
29 */
30
31 /**
32 * Exception thrown when trying to replace an already active service.
33 */
34 class CannotReplaceActiveServiceException extends RuntimeException {
35
36 /**
37 * @param string $serviceName
38 * @param Exception|null $previous
39 */
40 public function __construct( $serviceName, Exception $previous = null ) {
41 parent::__construct( "Cannot replace an active service: $serviceName", 0, $previous );
42 }
43
44 }
45
46 /**
47 * Retain the old class name for backwards compatibility.
48 * @deprecated since 1.33
49 */
50 class_alias( CannotReplaceActiveServiceException::class,
51 'MediaWiki\Services\CannotReplaceActiveServiceException' );