1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace JMS\Serializer\Handler; |
6
|
|
|
|
7
|
|
|
use JMS\Serializer\GraphNavigatorInterface; |
8
|
|
|
use JMS\Serializer\Metadata\StaticPropertyMetadata; |
9
|
|
|
use JMS\Serializer\SerializationContext; |
10
|
|
|
use JMS\Serializer\Type\Type; |
11
|
|
|
use JMS\Serializer\Visitor\SerializationVisitorInterface; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @author Asmir Mustafic <[email protected]> |
15
|
|
|
* |
16
|
|
|
* @phpstan-import-type TypeArray from Type |
17
|
329 |
|
*/ |
18
|
|
|
final class StdClassHandler implements SubscribingHandlerInterface |
19
|
329 |
|
{ |
20
|
329 |
|
/** |
21
|
|
|
* {@inheritdoc} |
22
|
329 |
|
*/ |
23
|
329 |
|
public static function getSubscribingMethods() |
24
|
329 |
|
{ |
25
|
329 |
|
$methods = []; |
26
|
329 |
|
$formats = ['json', 'xml']; |
27
|
329 |
|
|
28
|
|
|
foreach ($formats as $format) { |
29
|
|
|
$methods[] = [ |
30
|
|
|
'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
31
|
329 |
|
'type' => \stdClass::class, |
32
|
|
|
'format' => $format, |
33
|
|
|
'method' => 'serializeStdClass', |
34
|
7 |
|
]; |
35
|
|
|
} |
36
|
7 |
|
|
37
|
7 |
|
return $methods; |
38
|
|
|
} |
39
|
7 |
|
|
40
|
4 |
|
/** |
41
|
4 |
|
* @param TypeArray $type |
|
|
|
|
42
|
|
|
* |
43
|
|
|
* @return mixed |
44
|
7 |
|
*/ |
45
|
|
|
public function serializeStdClass(SerializationVisitorInterface $visitor, \stdClass $stdClass, array $type, SerializationContext $context) |
|
|
|
|
46
|
|
|
{ |
47
|
|
|
$classMetadata = $context->getMetadataFactory()->getMetadataForClass('stdClass'); |
48
|
|
|
$visitor->startVisitingObject($classMetadata, $stdClass, ['name' => 'stdClass']); |
|
|
|
|
49
|
|
|
|
50
|
|
|
foreach ((array) $stdClass as $name => $value) { |
51
|
|
|
$metadata = new StaticPropertyMetadata('stdClass', $name, $value); |
52
|
|
|
$visitor->visitProperty($metadata, $value); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
return $visitor->endVisitingObject($classMetadata, $stdClass, ['name' => 'stdClass']); |
|
|
|
|
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|
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