Debian Codegraph @

vendor/wikimedia/idle-dom/src/SelectionMode.php

raw
1 <?php
2
3 // AUTOMATICALLY GENERATED. DO NOT EDIT.
4 // Use `composer build` to regenerate.
5
6 namespace Wikimedia\IDLeDOM;
7
8 /**
9 * SelectionMode
10 *
11 * @see https://dom.spec.whatwg.org/#enumdef-selectionmode
12 *
13 * @phan-forbid-undeclared-magic-properties
14 */
15 final class SelectionMode {
16 /* Enumeration values */
17 public const select = 'select';
18 public const start = 'start';
19 public const end = 'end';
20 public const preserve = 'preserve';
21
22 private function __construct() {
23 /* Enumerations can't be instantiated */
24 }
25
26 // @phan-file-suppress PhanTypeInvalidThrowsIsInterface
27
28 /**
29 * Throw a TypeError if the provided string is not a
30 * valid member of this enumeration.
31 *
32 * @param string $value The string to test
33 * @return string The provided string, if it is valid
34 * @throws \Wikimedia\IDLeDOM\TypeError if it is not valid
35 */
36 public static function cast( string $value ): string {
37 switch ( $value ) {
38 case 'select':
39 case 'start':
40 case 'end':
41 case 'preserve':
42 return $value;
43 default:
44 throw new class() extends \Exception implements \Wikimedia\IDLeDOM\TypeError {
45 };
46 }
47 }
48 }