Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
66.67% covered (warning)
66.67%
4 / 6
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
ShadowRootMode
66.67% covered (warning)
66.67%
4 / 6
0.00% covered (danger)
0.00%
0 / 2
5.93
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 cast
80.00% covered (warning)
80.00%
4 / 5
0.00% covered (danger)
0.00%
0 / 1
4.13
1<?php
2
3// AUTOMATICALLY GENERATED.  DO NOT EDIT.
4// Use `composer build` to regenerate.
5
6namespace Wikimedia\IDLeDOM;
7
8/**
9 * ShadowRootMode
10 *
11 * @see https://dom.spec.whatwg.org/#enumdef-shadowrootmode
12 *
13 * @phan-forbid-undeclared-magic-properties
14 */
15final 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}