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