Code

< 40 %
40-60 %
> 60 %
1
<?php
2
3
/**
4
 * Part of SplTypes package.
5
 *
6
 * (c) Adrien Loyant <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Ducks\Component\SplTypes;
15
16
/**
17
 * SplIntEnum gives the ability to emulate and create int enumeration objects natively in PHP.
18
 *
19
 * @extends SplEnumBacked<int>
20
 *
21
 * @psalm-api
22
 */
23
abstract class SplIntEnum extends SplEnumBacked
24
{
25
    /**
26
     * Value of enum instance.
27
     *
28
     * @var int
29
     */
30
    protected int $value;
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    final protected function __construct()
36
    {
37
        $this->__default = 0;
38
39
        parent::__construct();
40
    }
41
42
    final public function &__invoke(): int
43
    {
44
        return $this->__default;
45
    }
46
}
47