Issues (12)

SerializeAsStringSubscriberHandler.php (4 issues)

Labels
Severity
1
<?php declare(strict_types=1);
2
namespace SpareParts\Enum\Bridge\JmsSerializer;
3
4
use JMS\Serializer\Context;
0 ignored issues
show
The type JMS\Serializer\Context was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
use JMS\Serializer\GraphNavigator;
0 ignored issues
show
The type JMS\Serializer\GraphNavigator was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use JMS\Serializer\Handler\SubscribingHandlerInterface;
0 ignored issues
show
The type JMS\Serializer\Handler\SubscribingHandlerInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use JMS\Serializer\VisitorInterface;
0 ignored issues
show
The type JMS\Serializer\VisitorInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use SpareParts\Enum\Converter\LowercaseConverter;
9
use SpareParts\Enum\Enum;
10
11
class SerializeAsStringSubscriberHandler implements SubscribingHandlerInterface
12
{
13
	public static function getSubscribingMethods(): array
14
	{
15
		return [
16
			[
17
				'direction' => GraphNavigator::DIRECTION_SERIALIZATION,
18
				'format' => 'json',
19
				'type' => 'enum',
20
				'method' => 'serializeEnum',
21
			]
22
		];
23
	}
24
25
	public function serializeEnum(VisitorInterface $visitor, Enum $enum, array $type, Context $context)
26
	{
27
		$converter = new LowercaseConverter(get_class($enum));
28
		return $visitor->visitString($converter->fromEnum($enum), $type, $context);
29
	}
30
}
31