Debian Codegraph @

vendor/wikimedia/idle-dom/src/ShadowRootMode.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 * ShadowRootMode
10 *
11 * @see https://dom.spec.whatwg.org/#enumdef-shadowrootmode
12 *
13 * @phan-forbid-undeclared-magic-properties
14 */
15 final class ShadowRootMode {
16 /* Enumeration values */
17 public const open = 'open';
18 public const closed = 'closed';
19
20 private function __construct() {
21 /* Enumerations can't be instantiated */
22 }
23
24 // @phan-file-suppress PhanTypeInvalidThrowsIsInterface
25
26 /**
27 * Throw a TypeError if the provided string is not a
28 * valid member of this enumeration.
29 *
30 * @param string $value The string to test
31 * @return string The provided string, if it is valid
32 * @throws \Wikimedia\IDLeDOM\TypeError if it is not valid
33 */
34 public static function cast( string $value ): string {
35 switch ( $value ) {
36 case 'open':
37 case 'closed':
38 return $value;
39 default:
40 throw new class() extends \Exception implements \Wikimedia\IDLeDOM\TypeError {
41 };
42 }
43 }
44 }