1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\String; |
4
|
|
|
|
5
|
|
|
// phpcs:disable Generic.Files.LineLength.TooLong |
6
|
|
|
|
7
|
|
|
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; |
8
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Interfaces\String\JsonDataFieldInterface; |
9
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\Entity\Validation\Constraints\DomainName; |
|
|
|
|
10
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\Entity\Validation\Constraints\FieldConstraints\JsonData; |
11
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\MappingHelper; |
12
|
|
|
use Symfony\Component\Validator\Mapping\ClassMetadata as ValidatorClassMetaData; |
13
|
|
|
|
14
|
|
|
// phpcs:enable |
15
|
|
|
trait JsonDataFieldTrait |
16
|
|
|
{ |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var string|null |
20
|
|
|
*/ |
21
|
|
|
private $jsonData; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @SuppressWarnings(PHPMD.StaticAccess) |
25
|
|
|
* @param ClassMetadataBuilder $builder |
26
|
|
|
*/ |
27
|
|
|
public static function metaForJsonData(ClassMetadataBuilder $builder): void |
28
|
|
|
{ |
29
|
|
|
MappingHelper::setSimpleJsonFields( |
30
|
|
|
[JsonDataFieldInterface::PROP_JSON_DATA], |
31
|
|
|
$builder, |
32
|
|
|
JsonDataFieldInterface::DEFAULT_JSON_DATA, |
33
|
|
|
false |
|
|
|
|
34
|
|
|
); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Use a custom validator to call filter_var to validate that the domain name is valid |
39
|
|
|
* |
40
|
|
|
* @param ValidatorClassMetaData $metadata |
41
|
|
|
*/ |
42
|
|
|
protected static function validatorMetaForPropertyJsonData(ValidatorClassMetaData $metadata): void |
43
|
|
|
{ |
44
|
|
|
$metadata->addPropertyConstraint( |
45
|
|
|
JsonDataFieldInterface::PROP_JSON_DATA, |
46
|
|
|
new JsonData() |
47
|
|
|
); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @return string|null |
52
|
|
|
*/ |
53
|
|
|
public function getJsonData(): ?string |
54
|
|
|
{ |
55
|
|
|
if (null === $this->jsonData) { |
56
|
|
|
return JsonDataFieldInterface::DEFAULT_JSON_DATA; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
return $this->jsonData; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param string|null $json |
64
|
|
|
* |
65
|
|
|
* @return self |
66
|
|
|
*/ |
67
|
|
|
private function setJsonData(?string $json): self |
68
|
|
|
{ |
69
|
|
|
$this->updatePropertyValue( |
|
|
|
|
70
|
|
|
JsonDataFieldInterface::PROP_JSON_DATA, |
71
|
|
|
$json |
72
|
|
|
); |
73
|
|
|
|
74
|
|
|
return $this; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
private function initJsonData() |
78
|
|
|
{ |
79
|
|
|
$this->jsonData = JsonDataFieldInterface::DEFAULT_JSON_DATA; |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
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