Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
OrderStatus
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 ensureDraft
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2namespace Apie\IntegrationTests\Apie\TypeDemo\Enums;
3
4use LogicException;
5
6enum OrderStatus: string
7{
8    case DRAFT = 'draft';
9    case ACCEPTED = 'accepted';
10    case DELIVERED = 'delivered';
11
12    public function ensureDraft(): void
13    {
14        if ($this !== self::DRAFT) {
15            throw new LogicException('Order status should be draft for this operation');
16        }
17    }
18}