Total Complexity | 6 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | final class EnumSubscriber implements EventSubscriberInterface |
||
11 | { |
||
12 | public function onPreSerializeEnum(PreSerializeEvent $event): void |
||
13 | { |
||
14 | $type = $event->getType(); |
||
15 | |||
16 | if (isset($type['name']) && ('enum' === $type['name'] || !is_a($type['name'], \UnitEnum::class, true))) { |
||
|
|||
17 | return; |
||
18 | } |
||
19 | |||
20 | $object = $event->getObject(); |
||
21 | $params = [get_class($object), $object instanceof \BackedEnum ? 'value' : 'name']; |
||
22 | $event->setType('enum', $params); |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * {@inheritdoc} |
||
27 | */ |
||
28 | public static function getSubscribedEvents() |
||
32 | ]; |
||
33 | } |
||
35 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths