-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSplStringEnum.php
53 lines (46 loc) · 1 KB
/
SplStringEnum.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* Part of SplTypes package.
*
* (c) Adrien Loyant <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Ducks\Component\SplTypes;
/**
* SplStringEnum gives the ability to emulate and create int enumeration objects natively in PHP.
*
* @extends SplEnumBacked<string>
*
* @psalm-api
*/
abstract class SplStringEnum extends SplEnumBacked
{
/**
* Value of enum instance.
*
* @var string
*/
protected string $value;
/**
* {@inheritdoc}
*/
final protected function __construct()
{
$this->__default = '';
parent::__construct();
}
/**
* Method called when a script tries to call an object as a function.
*
* @return string
*
* @psalm-suppress MixedInferredReturnType
*/
final public function &__invoke(): string
{
return $this->__default;
}
}