INFO: Java 1.8.0_322 Amazon.com Inc. (64-bit)
INFO: Linux 4.4.0-1128-aws amd64
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/src/app/build/libs/sonarlint-core-2.17.0.899.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/src/app/build/libs/sonarlint-cli-2.1.0.566.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
INFO: Index files
INFO: Invalid character encountered in file '/code/docs/requirements.txt' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: 207 files indexed
INFO: 130 source files to be analyzed
ERROR: Unable to parse file: /code/src/ModelGenerator.php
ERROR: Parse error at line 122 column 9:
112: if ($this->generatorConfiguration->hasSerializationEnabled()) {
113: $this->addPostProcessor(new SerializationPostProcessor());
114: }
115:
116: $renderQueue = new RenderQueue();
117: $schemaProcessor = new SchemaProcessor(
118: $schemaProvider->getBaseDirectory(),
119: $destination,
120: $this->generatorConfiguration,
121: $renderQueue,
122: );
^
123:
124: foreach ($schemaProvider->getSchemas() as $jsonSchema) {
125: $schemaProcessor->process($jsonSchema);
126: }
127:
128: // render all collected classes
129: $renderQueue->execute($this->generatorConfiguration, $this->postProcessors);
130:
131: return $schemaProcessor->getGeneratedFiles();
132: }
ERROR: Unable to parse file: /code/src/PropertyProcessor/ComposedValueProcessorFactory.php
ERROR: Parse error at line 42 column 5:
32: /**
33: * @inheritdoc
34: *
35: * @throws SchemaException
36: */
37: public function getProcessor(
38: $type,
39: PropertyMetaDataCollection $propertyMetaDataCollection,
40: SchemaProcessor $schemaProcessor,
41: Schema $schema,
42: ): PropertyProcessorInterface {
^
43: $processor = '\\PHPModelGenerator\\PropertyProcessor\\ComposedValue\\' . ucfirst($type) . 'Processor';
44:
45: $params = [$propertyMetaDataCollection, $schemaProcessor, $schema];
46:
47: if (is_a($processor, AbstractComposedValueProcessor::class, true)) {
48: $params[] = $this->rootLevelComposition;
49: }
50:
51: return new $processor(...$params);
52: }
ERROR: Unable to parse file: /code/src/PropertyProcessor/Property/AbstractPropertyProcessor.php
ERROR: Parse error at line 52 column 5:
42: * AbstractPropertyProcessor constructor.
43: *
44: * @param PropertyMetaDataCollection $propertyMetaDataCollection
45: * @param SchemaProcessor $schemaProcessor
46: * @param Schema $schema
47: */
48: public function __construct(
49: PropertyMetaDataCollection $propertyMetaDataCollection,
50: SchemaProcessor $schemaProcessor,
51: Schema $schema,
52: ) {
^
53: $this->propertyMetaDataCollection = $propertyMetaDataCollection;
54: $this->schemaProcessor = $schemaProcessor;
55: $this->schema = $schema;
56: }
57:
58: /**
59: * Generates the validators for the property
60: *
61: * @param PropertyInterface $property
62: * @param JsonSchema $propertySchema
ERROR: Unable to parse file: /code/src/PropertyProcessor/Property/AbstractTypedValueProcessor.php
ERROR: Parse error at line 35 column 5:
25: * AbstractTypedValueProcessor constructor.
26: *
27: * @param PropertyMetaDataCollection $propertyMetaDataCollection
28: * @param SchemaProcessor $schemaProcessor
29: * @param Schema $schema
30: */
31: public function __construct(
32: PropertyMetaDataCollection $propertyMetaDataCollection,
33: SchemaProcessor $schemaProcessor,
34: Schema $schema,
35: ) {
^
36: parent::__construct($propertyMetaDataCollection, $schemaProcessor, $schema, static::TYPE);
37: }
38:
39: /**
40: * @param string $propertyName
41: * @param JsonSchema $propertySchema
42: *
43: * @return PropertyInterface
44: *
45: * @throws SchemaException
ERROR: Unable to parse file: /code/src/PropertyProcessor/Property/ConstProcessor.php
ERROR: Parse error at line 35 column 9:
25: */
26: public function process(string $propertyName, JsonSchema $propertySchema): PropertyInterface
27: {
28: $json = $propertySchema->getJson();
29:
30: $property = new Property(
31: $propertyName,
32: new PropertyType(TypeConverter::gettypeToInternal(gettype($json['const']))),
33: $propertySchema,
34: $json['description'] ?? '',
35: );
^
36:
37: return $property
38: ->setRequired(true)
39: ->addValidator(new PropertyValidator(
40: $property,
41: '$value !== ' . var_export($json['const'], true),
42: InvalidConstException::class,
43: [$json['const']],
44: ));
45: }
ERROR: Unable to parse file: /code/src/PropertyProcessor/Property/MultiTypeProcessor.php
ERROR: Parse error at line 52 column 5:
42: * @param Schema $schema
43: *
44: * @throws SchemaException
45: */
46: public function __construct(
47: PropertyProcessorFactory $propertyProcessorFactory,
48: array $types,
49: PropertyMetaDataCollection $propertyMetaDataCollection,
50: SchemaProcessor $schemaProcessor,
51: Schema $schema,
52: ) {
^
53: parent::__construct($propertyMetaDataCollection, $schemaProcessor, $schema);
54:
55: foreach ($types as $type) {
56: $this->propertyProcessors[$type] = $propertyProcessorFactory->getProcessor(
57: $type,
58: $propertyMetaDataCollection,
59: $schemaProcessor,
60: $schema,
61: );
62: }
ERROR: Unable to parse file: /code/src/PropertyProcessor/Property/BaseProcessor.php
ERROR: Parse error at line 109 column 13:
99: {
100: if (!isset($propertySchema->getJson()['propertyNames'])) {
101: return;
102: }
103:
104: $this->schema->addBaseValidator(
105: new PropertyNamesValidator(
106: $this->schemaProcessor,
107: $this->schema,
108: $propertySchema->withJson($propertySchema->getJson()['propertyNames']),
109: )
^
110: );
111: }
112:
113: /**
114: * Add an object validator to specify constraints for properties which are not defined in the schema
115: *
116: * @param JsonSchema $propertySchema
117: *
118: * @throws FileSystemException
119: * @throws SchemaException
ERROR: Unable to parse file: /code/src/PropertyProcessor/Property/ReferenceProcessor.php
ERROR: Parse error at line 44 column 21:
34: if ($definition) {
35: if ($this->schema->getClassPath() !== $definition->getSchema()->getClassPath() ||
36: $this->schema->getClassName() !== $definition->getSchema()->getClassName() ||
37: (
38: $this->schema->getClassName() === 'ExternalSchema' &&
39: $definition->getSchema()->getClassName() === 'ExternalSchema'
40: )
41: ) {
42: $this->schema->addNamespaceTransferDecorator(
43: new SchemaNamespaceTransferDecorator($definition->getSchema()),
44: );
^
45: }
46:
47: return $definition->resolveReference($propertyName, $path, $this->propertyMetaDataCollection);
48: }
49: } catch (Exception $exception) {
50: throw new SchemaException(
51: "Unresolved Reference $reference in file {$propertySchema->getFile()}",
52: 0,
53: $exception,
54: );
ERROR: Unable to parse file: /code/src/PropertyProcessor/Property/AbstractNumericProcessor.php
ERROR: Parse error at line 47 column 9:
37:
38: $this->addRangeValidator($property, $propertySchema, self::JSON_FIELD_MINIMUM, '<', MinimumException::class);
39: $this->addRangeValidator($property, $propertySchema, self::JSON_FIELD_MAXIMUM, '>', MaximumException::class);
40:
41: $this->addRangeValidator(
42: $property,
43: $propertySchema,
44: self::JSON_FIELD_MINIMUM_EXCLUSIVE,
45: '<=',
46: ExclusiveMinimumException::class,
47: );
^
48:
49: $this->addRangeValidator(
50: $property,
51: $propertySchema,
52: self::JSON_FIELD_MAXIMUM_EXCLUSIVE,
53: '>=',
54: ExclusiveMaximumException::class,
55: );
56:
57: $this->addMultipleOfValidator($property, $propertySchema);
ERROR: Unable to parse file: /code/src/PropertyProcessor/Property/BasereferenceProcessor.php
ERROR: Parse error at line 38 column 17:
28: ->setUpDefinitionDictionary($this->schemaProcessor, $this->schema);
29:
30: $property = parent::process($propertyName, $propertySchema);
31:
32: if (!$property->getNestedSchema()) {
33: throw new SchemaException(
34: sprintf(
35: 'A referenced schema on base level must provide an object definition for property %s in file %s',
36: $propertyName,
37: $propertySchema->getFile(),
38: )
^
39: );
40: }
41:
42: foreach ($property->getNestedSchema()->getProperties() as $propertiesOfReferencedObject) {
43: $this->schema->addProperty($propertiesOfReferencedObject);
44: }
45:
46: return $property;
47: }
48: }
ERROR: Unable to parse file: /code/src/PropertyProcessor/Property/ArrayProcessor.php
ERROR: Parse error at line 71 column 17:
61:
62: if (!$property->isRequired() &&
63: $this->schemaProcessor->getGeneratorConfiguration()->isDefaultArraysToEmptyArrayEnabled()
64: ) {
65: $property->addDecorator(new DefaultArrayToEmptyArrayDecorator());
66:
67: if ($property->getType()) {
68: $property->setType(
69: $property->getType(),
70: new PropertyType($property->getType(true)->getName(), false),
71: );
^
72: }
73:
74: if (!$property->getDefaultValue()) {
75: $property->setDefaultValue([]);
76: }
77: }
78: }
79:
80: /**
81: * Add the vaidation for the allowed amount of items in the array
ERROR: Unable to parse file: /code/src/PropertyProcessor/Property/StringProcessor.php
ERROR: Parse error at line 70 column 17:
60:
61: $escapedPattern = addcslashes($json[static::JSON_FIELD_PATTERN], '/');
62:
63: if (@preg_match("/$escapedPattern/", '') === false) {
64: throw new SchemaException(
65: sprintf(
66: "Invalid pattern '%s' for property '%s' in file %s",
67: $json[static::JSON_FIELD_PATTERN],
68: $property->getName(),
69: $propertySchema->getFile(),
70: )
^
71: );
72: }
73:
74: $encodedPattern = base64_encode("/$escapedPattern/");
75:
76: $property->addValidator(
77: new PropertyValidator(
78: $property,
79: $this->getTypeCheck() . "!preg_match(base64_decode('$encodedPattern'), \$value)",
80: PatternException::class,
ERROR: Unable to parse file: /code/src/PropertyProcessor/Property/ObjectProcessor.php
ERROR: Parse error at line 38 column 9:
28: */
29: public function process(string $propertyName, JsonSchema $propertySchema): PropertyInterface
30: {
31: $property = parent::process($propertyName, $propertySchema);
32:
33: $className = $this->schemaProcessor->getGeneratorConfiguration()->getClassNameGenerator()->getClassName(
34: $propertyName,
35: $propertySchema,
36: false,
37: $this->schemaProcessor->getCurrentClassName(),
38: );
^
39:
40: $schema = $this->schemaProcessor->processSchema(
41: $propertySchema,
42: $this->schemaProcessor->getCurrentClassPath(),
43: $className,
44: $this->schema->getSchemaDictionary(),
45: );
46:
47: // if the generated schema is located in a different namespace (the schema for the given structure in
48: // $propertySchema is duplicated) add used classes to the current schema. By importing the class which is
ERROR: Unable to parse file: /code/src/PropertyProcessor/Property/AbstractValueProcessor.php
ERROR: Parse error at line 40 column 5:
30: * @param PropertyMetaDataCollection $propertyMetaDataCollection
31: * @param SchemaProcessor $schemaProcessor
32: * @param Schema $schema
33: * @param string $type
34: */
35: public function __construct(
36: PropertyMetaDataCollection $propertyMetaDataCollection,
37: SchemaProcessor $schemaProcessor,
38: Schema $schema,
39: string $type = '',
40: ) {
^
41: parent::__construct($propertyMetaDataCollection, $schemaProcessor, $schema);
42: $this->type = $type;
43: }
44:
45: /**
46: * @inheritdoc
47: *
48: * @throws ReflectionException
49: * @throws SchemaException
50: */
ERROR: Unable to parse file: /code/src/PropertyProcessor/PropertyProcessorFactory.php
ERROR: Parse error at line 33 column 5:
23: * @param Schema $schema
24: *
25: * @return PropertyProcessorInterface
26: * @throws SchemaException
27: */
28: public function getProcessor(
29: $type,
30: PropertyMetaDataCollection $propertyMetaDataCollection,
31: SchemaProcessor $schemaProcessor,
32: Schema $schema,
33: ): PropertyProcessorInterface {
^
34: if (is_string($type)) {
35: return $this->getSingleTypePropertyProcessor(
36: $type,
37: $propertyMetaDataCollection,
38: $schemaProcessor,
39: $schema,
40: );
41: }
42:
43: if (is_array($type)) {
ERROR: Unable to parse file: /code/src/PropertyProcessor/Decorator/Property/ObjectInstantiationDecorator.php
ERROR: Parse error at line 42 column 13:
32: * @param GeneratorConfiguration $generatorConfiguration
33: */
34: public function __construct(string $className, GeneratorConfiguration $generatorConfiguration)
35: {
36: $this->className = $className;
37: $this->generatorConfiguration = $generatorConfiguration;
38:
39: if (!static::$renderer) {
40: static::$renderer = new Render(
41: join(DIRECTORY_SEPARATOR, [__DIR__, '..', '..', '..', 'Templates']) . DIRECTORY_SEPARATOR,
42: );
^
43: }
44: }
45:
46: /**
47: * @inheritdoc
48: */
49: public function decorate(string $input, PropertyInterface $property, bool $nestedProperty): string
50: {
51: return static::$renderer->renderTemplate(
52: DIRECTORY_SEPARATOR . 'Decorator' . DIRECTORY_SEPARATOR . 'ObjectInstantiationDecorator.phptpl',
ERROR: Unable to parse file: /code/src/PropertyProcessor/Decorator/TypeHint/ArrayTypeHintDecorator.php
ERROR: Parse error at line 48 column 13:
38: return $this->nestedProperty->getTypeHint($outputType, [self::class]);
39: }
40:
41: $result = implode(
42: '|',
43: array_map(
44: static function (string $typeHint): string {
45: return "{$typeHint}[]";
46: },
47: explode('|', $this->nestedProperty->getTypeHint($outputType)),
48: )
^
49: );
50:
51: $this->recursiveArrayCheck--;
52:
53: return $result;
54: }
55: }
56:
ERROR: Unable to parse file: /code/src/PropertyProcessor/ComposedValue/IfProcessor.php
ERROR: Parse error at line 43 column 17:
33: protected function generateValidators(PropertyInterface $property, JsonSchema $propertySchema): void
34: {
35: $json = $propertySchema->getJson()['propertySchema']->getJson();
36:
37: if (!isset($json['then']) && !isset($json['else'])) {
38: throw new SchemaException(
39: sprintf(
40: 'Incomplete conditional composition for property %s in file %s',
41: $property->getName(),
42: $property->getJsonSchema()->getFile(),
43: )
^
44: );
45: }
46:
47: $propertyFactory = new PropertyFactory(new PropertyProcessorFactory());
48:
49: $properties = [];
50:
51: foreach (['if', 'then', 'else'] as $compositionElement) {
52: if (!isset($json[$compositionElement])) {
53: $properties[$compositionElement] = null;
ERROR: Unable to parse file: /code/src/PropertyProcessor/ComposedValue/AbstractComposedValueProcessor.php
ERROR: Parse error at line 50 column 5:
40: * @param PropertyMetaDataCollection $propertyMetaDataCollection
41: * @param SchemaProcessor $schemaProcessor
42: * @param Schema $schema
43: * @param bool $rootLevelComposition
44: */
45: public function __construct(
46: PropertyMetaDataCollection $propertyMetaDataCollection,
47: SchemaProcessor $schemaProcessor,
48: Schema $schema,
49: bool $rootLevelComposition,
50: ) {
^
51: parent::__construct($propertyMetaDataCollection, $schemaProcessor, $schema);
52:
53: $this->rootLevelComposition = $rootLevelComposition;
54: }
55:
56: /**
57: * @inheritdoc
58: */
59: protected function generateValidators(PropertyInterface $property, JsonSchema $propertySchema): void
60: {
ERROR: Unable to parse file: /code/src/PropertyProcessor/ComposedValue/NotProcessor.php
ERROR: Parse error at line 35 column 17:
25: $json['not'] = [$json['not']];
26:
27: // strict type checks for not constraint to avoid issues with null
28: $property->setRequired(true);
29: parent::generateValidators(
30: $property,
31: $propertySchema->withJson(
32: array_merge(
33: $propertySchema->getJson(),
34: ['propertySchema' => $propertySchema->getJson()['propertySchema']->withJson($json)],
35: )
^
36: ),
37: );
38: }
39:
40: /**
41: * @inheritdoc
42: */
43: protected function getComposedValueValidation(int $composedElements): string
44: {
45: return '$succeededCompositionElements === 0';
ERROR: Unable to parse file: /code/src/PropertyProcessor/Filter/FilterProcessor.php
ERROR: Parse error at line 48 column 5:
38: * @param Schema $schema
39: *
40: * @throws ReflectionException
41: * @throws SchemaException
42: */
43: public function process(
44: PropertyInterface $property,
45: $filterList,
46: GeneratorConfiguration $generatorConfiguration,
47: Schema $schema,
48: ): void {
^
49: if (is_string($filterList) || (is_array($filterList) && isset($filterList['filter']))) {
50: $filterList = [$filterList];
51: }
52:
53: $transformingFilter = null;
54: // apply a different priority to each filter to make sure the order is kept
55: $filterPriority = 10 + count($property->getValidators());
56:
57: foreach ($filterList as $filterToken) {
58: $filterOptions = [];
ERROR: Unable to parse file: /code/src/PropertyProcessor/PropertyFactory.php
ERROR: Parse error at line 51 column 5:
41: *
42: * @return PropertyInterface
43: * @throws SchemaException
44: */
45: public function create(
46: PropertyMetaDataCollection $propertyMetaDataCollection,
47: SchemaProcessor $schemaProcessor,
48: Schema $schema,
49: string $propertyName,
50: JsonSchema $propertySchema,
51: ): PropertyInterface {
^
52: $json = $propertySchema->getJson();
53:
54: // redirect properties with a constant value to the ConstProcessor
55: if (isset($json['const'])) {
56: $json['type'] = 'const';
57: }
58: // redirect references to the ReferenceProcessor
59: if (isset($json['$ref'])) {
60: $json['type'] = isset($json['type']) && $json['type'] === 'base'
61: ? 'baseReference'
ERROR: Unable to parse file: /code/src/PropertyProcessor/ProcessorFactoryInterface.php
ERROR: Parse error at line 30 column 5:
20: * @param SchemaProcessor $schemaProcessor
21: * @param Schema $schema
22: *
23: * @return PropertyProcessorInterface
24: */
25: public function getProcessor(
26: $type,
27: PropertyMetaDataCollection $propertyMetaDataCollection,
28: SchemaProcessor $schemaProcessor,
29: Schema $schema,
30: ): PropertyProcessorInterface;
^
31: }
32:
ERROR: Unable to parse file: /code/src/Utils/RenderHelper.php
ERROR: Parse error at line 106 column 9:
96: * @param PropertyValidatorInterface $validator
97: *
98: * @return string
99: */
100: public function validationError(PropertyValidatorInterface $validator): string
101: {
102: $exceptionConstructor = sprintf(
103: 'new \%s($value ?? null, ...%s)',
104: $validator->getExceptionClass(),
105: preg_replace('/\'&(\$\w+)\'/i', '$1', var_export($validator->getExceptionParams(), true)),
106: );
^
107:
108: if ($this->generatorConfiguration->collectErrors()) {
109: return "\$this->_errorRegistry->addError($exceptionConstructor);";
110: }
111:
112: return "throw $exceptionConstructor;";
113: }
114:
115: /**
116: * check if the property may contain/accept null
ERROR: Unable to parse file: /code/src/Utils/NormalizedName.php
ERROR: Parse error at line 20 column 9:
10: class NormalizedName
11: {
12: public static function from(string $name, JsonSchema $jsonSchema): string
13: {
14: $attributeName = preg_replace_callback(
15: '/([a-z][a-z0-9]*)([A-Z])/',
16: static function (array $matches): string {
17: return "{$matches[1]}-{$matches[2]}";
18: },
19: $name,
20: );
^
21:
22: $elements = array_map(
23: static function (string $element): string {
24: return ucfirst(strtolower($element));
25: },
26: preg_split('/[^a-z0-9]/i', $attributeName),
27: );
28:
29: $attributeName = join('', $elements);
30:
ERROR: Unable to parse file: /code/src/Utils/ClassNameGeneratorInterface.php
ERROR: Parse error at line 32 column 5:
22: * @param bool $isMergeClass Is it a merge class? example: allOf schema composition
23: * @param string $currentClassName The class name of the parent class if the class represents a nested object
24: *
25: * @return string
26: */
27: public function getClassName(
28: string $propertyName,
29: JsonSchema $schema,
30: bool $isMergeClass,
31: string $currentClassName = '',
32: ): string;
^
33: }
34:
ERROR: Unable to parse file: /code/src/Utils/ClassNameGenerator.php
ERROR: Parse error at line 24 column 5:
14: class ClassNameGenerator implements ClassNameGeneratorInterface
15: {
16: /**
17: * @inheritDoc
18: */
19: public function getClassName(
20: string $propertyName,
21: JsonSchema $schema,
22: bool $isMergeClass,
23: string $currentClassName = '',
24: ): string {
^
25: $json = $isMergeClass && isset($schema->getJson()['propertySchema'])
26: ? $schema->getJson()['propertySchema']->getJson()
27: : $schema->getJson();
28:
29: $className = sprintf(
30: $isMergeClass ? '%s_Merged_%s' : '%s_%s',
31: $currentClassName,
32: ucfirst(
33: isset($json['$id'])
34: ? str_replace('#', '', $json['$id'])
ERROR: Unable to parse file: /code/src/Model/SchemaDefinition/JsonSchema.php
ERROR: Parse error at line 59 column 25:
49: // wrap in an allOf to pass the processing to multiple handlers - ugly hack to be removed after rework
50: if (isset($json['$ref']) && count(array_diff(array_intersect(array_keys($json), self::SCHEMA_SIGNATURE_RELEVANT_FIELDS), ['$ref', 'type']))) {
51: $json = array_merge(
52: array_diff_key($json, array_fill_keys(self::SCHEMA_SIGNATURE_RELEVANT_FIELDS, null)),
53: [
54: 'allOf' => [
55: ['$ref' => $json['$ref']],
56: array_intersect_key(
57: $json,
58: array_fill_keys(array_diff(self::SCHEMA_SIGNATURE_RELEVANT_FIELDS, ['$ref']), null),
59: ),
^
60: ],
61: ],
62: );
63: }
64:
65: $this->json = $json;
66: $this->file = $file;
67: }
68:
69: /**
ERROR: Unable to parse file: /code/src/Model/SchemaDefinition/SchemaDefinitionDictionary.php
ERROR: Parse error at line 55 column 13:
45:
46: foreach ($schema->getJsonSchema()->getJson() as $key => $propertyEntry) {
47: if (!is_array($propertyEntry)) {
48: continue;
49: }
50:
51: // add the root nodes of the schema to resolve path references
52: $this->addDefinition(
53: $key,
54: new SchemaDefinition($schema->getJsonSchema()->withJson($propertyEntry), $schemaProcessor, $schema),
55: );
^
56: }
57:
58: $this->fetchDefinitionsById($schema->getJsonSchema(), $schemaProcessor, $schema);
59: }
60:
61: /**
62: * Fetch all schema definitions with an ID for direct references
63: *
64: * @param JsonSchema $jsonSchema
65: * @param SchemaProcessor $schemaProcessor
ERROR: Unable to parse file: /code/src/Model/SchemaDefinition/SchemaDefinition.php
ERROR: Parse error at line 77 column 5:
67: *
68: * @return PropertyInterface
69: *
70: * @throws PHPModelGeneratorException
71: * @throws SchemaException
72: */
73: public function resolveReference(
74: string $propertyName,
75: array $path,
76: PropertyMetaDataCollection $propertyMetaDataCollection,
77: ): PropertyInterface {
^
78: $jsonSchema = $this->source->getJson();
79: $originalPath = $path;
80:
81: while ($segment = array_shift($path)) {
82: if (!isset($jsonSchema[$segment])) {
83: throw new SchemaException("Unresolved path segment $segment in file {$this->source->getFile()}");
84: }
85:
86: $jsonSchema = $jsonSchema[$segment];
87: }
ERROR: Unable to parse file: /code/src/Model/Property/PropertyInterface.php
ERROR: Parse error at line 54 column 5:
44: * @param PropertyType|null $outputType By default the output type will be equal to the base type but due to applied
45: * filters the output type may change
46: * @param bool $reset set to true for a full type reset (including type hint decorators like array, ...)
47: *
48: * @return PropertyInterface
49: */
50: public function setType(
51: ?PropertyType $type = null,
52: ?PropertyType $outputType = null,
53: bool $reset = false,
54: ): PropertyInterface;
^
55:
56: /**
57: * @param bool $outputType If set to true the output type hint will be returned (may differ from the base type)
58: * @param string[] $skipDecorators Provide a set of decorators (FQCN) which shouldn't be applied
59: * (might be necessary to avoid infinite loops for recursive calls)
60: * @return string
61: */
62: public function getTypeHint(bool $outputType = false, array $skipDecorators = []): string;
63:
64: /**
ERROR: Unable to parse file: /code/src/Model/Property/PropertyProxy.php
ERROR: Parse error at line 44 column 5:
34: * @param ResolvedDefinitionsCollection $definitionsCollection
35: * @param string $key
36: *
37: * @throws SchemaException
38: */
39: public function __construct(
40: string $name,
41: JsonSchema $jsonSchema,
42: ResolvedDefinitionsCollection $definitionsCollection,
43: string $key,
44: ) {
^
45: parent::__construct($name, $jsonSchema);
46:
47: $this->key = $key;
48: $this->definitionsCollection = $definitionsCollection;
49: }
50:
51: /**
52: * Get the property out of the resolved definitions collection to proxy function calls
53: *
54: * @return PropertyInterface
ERROR: Unable to parse file: /code/src/Model/Property/Property.php
ERROR: Parse error at line 96 column 5:
86: return $outputType && $this->outputType !== null ? $this->outputType : $this->type;
87: }
88:
89: /**
90: * @inheritdoc
91: */
92: public function setType(
93: ?PropertyType $type = null,
94: ?PropertyType $outputType = null,
95: bool $reset = false,
96: ): PropertyInterface {
^
97: if ($reset) {
98: $this->typeHintDecorators = [];
99: }
100:
101: $this->type = $type;
102: $this->outputType = $outputType;
103:
104: return $this;
105: }
106:
ERROR: Unable to parse file: /code/src/Model/Property/CompositionPropertyDecorator.php
ERROR: Parse error at line 44 column 9:
34: *
35: * @throws SchemaException
36: */
37: public function __construct(string $propertyName, JsonSchema $jsonSchema, PropertyInterface $property)
38: {
39: parent::__construct(
40: $propertyName,
41: $jsonSchema,
42: new ResolvedDefinitionsCollection([self::PROPERTY_KEY => $property]),
43: self::PROPERTY_KEY,
44: );
^
45:
46: $property->onResolve(function (): void {
47: $this->resolve();
48: });
49: }
50:
51: /**
52: * Append an object property which is affected by the composition validator
53: *
54: * @param PropertyInterface $property
ERROR: Unable to parse file: /code/src/Model/Validator/ComposedPropertyValidator.php
ERROR: Parse error at line 29 column 5:
19: class ComposedPropertyValidator extends AbstractComposedPropertyValidator
20: {
21: private $modifiedValuesMethod;
22:
23: public function __construct(
24: GeneratorConfiguration $generatorConfiguration,
25: PropertyInterface $property,
26: array $composedProperties,
27: string $compositionProcessor,
28: array $validatorVariables,
29: ) {
^
30: $this->modifiedValuesMethod = '_getModifiedValues_' . substr(md5(spl_object_hash($this)), 0, 5);
31: $this->isResolved = true;
32:
33: parent::__construct(
34: $generatorConfiguration,
35: $property,
36: DIRECTORY_SEPARATOR . 'Validator' . DIRECTORY_SEPARATOR . 'ComposedItem.phptpl',
37: array_merge($validatorVariables, ['modifiedValuesMethod' => $this->modifiedValuesMethod]),
38: $this->getExceptionByProcessor($compositionProcessor),
39: ['&$succeededCompositionElements', '&$compositionErrorCollection'],
ERROR: Unable to parse file: /code/src/Model/Validator/ArrayItemValidator.php
ERROR: Parse error at line 46 column 5:
36: * @param JsonSchema $itemStructure
37: * @param PropertyInterface $property
38: *
39: * @throws SchemaException
40: */
41: public function __construct(
42: SchemaProcessor $schemaProcessor,
43: Schema $schema,
44: JsonSchema $itemStructure,
45: PropertyInterface $property,
46: ) {
^
47: $nestedPropertyName = "item of array {$property->getName()}";
48: $this->variableSuffix = '_' . md5($nestedPropertyName);
49:
50: // an item of the array behaves like a nested property to add item-level validation
51: $this->nestedProperty = (new PropertyFactory(new PropertyProcessorFactory()))
52: ->create(
53: new PropertyMetaDataCollection([$nestedPropertyName]),
54: $schemaProcessor,
55: $schema,
56: $nestedPropertyName,
ERROR: Unable to parse file: /code/src/Model/Validator/InstanceOfValidator.php
ERROR: Parse error at line 29 column 13:
19: *
20: * @param PropertyInterface $property
21: */
22: public function __construct(PropertyInterface $property)
23: {
24: parent::__construct(
25: $property,
26: sprintf(
27: 'is_object($value) && !($value instanceof \Exception) && !($value instanceof %s)',
28: $property->getType()->getName(),
29: ),
^
30: InvalidInstanceOfException::class,
31: [$property->getType()->getName()],
32: );
33: }
34: }
35:
ERROR: Unable to parse file: /code/src/Model/Validator/ReflectionTypeCheckValidator.php
ERROR: Parse error at line 26 column 5:
16: {
17: /**
18: * @param ReflectionType $reflectionType
19: * @param PropertyInterface $property
20: *
21: * @return static
22: */
23: public static function fromReflectionType(
24: ReflectionType $reflectionType,
25: PropertyInterface $property,
26: ): self {
^
27: return new self(
28: $reflectionType->isBuiltin(),
29: $reflectionType->getName(),
30: $property,
31: );
32: }
33:
34: /**
35: * @param string $type
36: * @param PropertyInterface $property
ERROR: Unable to parse file: /code/src/Model/Validator/PassThroughTypeCheckValidator.php
ERROR: Parse error at line 32 column 5:
22: * PassThroughTypeCheckValidator constructor.
23: *
24: * @param ReflectionType $passThroughType
25: * @param PropertyInterface $property
26: * @param TypeCheckValidator $typeCheckValidator
27: */
28: public function __construct(
29: ReflectionType $passThroughType,
30: PropertyInterface $property,
31: TypeCheckValidator $typeCheckValidator,
32: ) {
^
33: $this->types = array_merge($typeCheckValidator->getTypes(), [$passThroughType->getName()]);
34:
35: parent::__construct(
36: $property,
37: sprintf(
38: '%s && %s',
39: ReflectionTypeCheckValidator::fromReflectionType($passThroughType, $property)->getCheck(),
40: $typeCheckValidator->getCheck(),
41: ),
42: InvalidTypeException::class,
ERROR: Unable to parse file: /code/src/Model/Validator/AdditionalPropertiesValidator.php
ERROR: Parse error at line 53 column 5:
43: * @param JsonSchema $propertiesStructure
44: * @param string|null $propertyName
45: *
46: * @throws SchemaException
47: */
48: public function __construct(
49: SchemaProcessor $schemaProcessor,
50: Schema $schema,
51: JsonSchema $propertiesStructure,
52: ?string $propertyName = null,
53: ) {
^
54: $propertyFactory = new PropertyFactory(new PropertyProcessorFactory());
55:
56: $this->validationProperty = $propertyFactory->create(
57: new PropertyMetaDataCollection([static::PROPERTY_NAME]),
58: $schemaProcessor,
59: $schema,
60: static::PROPERTY_NAME,
61: $propertiesStructure->withJson($propertiesStructure->getJson()[static::ADDITIONAL_PROPERTIES_KEY]),
62: );
63:
ERROR: Unable to parse file: /code/src/Model/Validator/PropertyTemplateValidator.php
ERROR: Parse error at line 45 column 5:
35: * @param array $templateValues
36: * @param string $exceptionClass
37: * @param array $exceptionParams
38: */
39: public function __construct(
40: PropertyInterface $property,
41: string $template,
42: array $templateValues,
43: string $exceptionClass,
44: array $exceptionParams = [],
45: ) {
^
46: $this->template = $template;
47: $this->templateValues = $templateValues;
48:
49: parent::__construct($property, $exceptionClass, $exceptionParams);
50: }
51:
52: public function setScope(Schema $schema): void
53: {
54: $this->scope = $schema;
55:
ERROR: Unable to parse file: /code/src/Model/Validator/MultiTypeCheckValidator.php
ERROR: Parse error at line 45 column 17:
35:
36: parent::__construct(
37: $property,
38: join(
39: ' && ',
40: array_map(
41: static function (string $allowedType) use ($property) : string {
42: return ReflectionTypeCheckValidator::fromType($allowedType, $property)->getCheck();
43: },
44: $types,
45: )
^
46: ) . ($allowImplicitNull ? ' && $value !== null' : ''),
47: InvalidTypeException::class,
48: [$types],
49: );
50: }
51:
52: /**
53: * @inheritDoc
54: */
55: public function getTypes(): array
ERROR: Unable to parse file: /code/src/Model/Validator/PatternPropertiesValidator.php
ERROR: Parse error at line 48 column 5:
38: * @param string $pattern
39: * @param JsonSchema $propertyStructure
40: *
41: * @throws SchemaException
42: */
43: public function __construct(
44: SchemaProcessor $schemaProcessor,
45: Schema $schema,
46: string $pattern,
47: JsonSchema $propertyStructure,
48: ) {
^
49: $this->pattern = $pattern;
50: $this->key = md5($propertyStructure->getJson()['key'] ?? $this->pattern);
51:
52: $propertyFactory = new PropertyFactory(new PropertyProcessorFactory());
53:
54: $this->validationProperty = $propertyFactory->create(
55: new PropertyMetaDataCollection(['pattern property']),
56: $schemaProcessor,
57: $schema,
58: 'pattern property',
ERROR: Unable to parse file: /code/src/Model/Validator/ArrayTupleValidator.php
ERROR: Parse error at line 44 column 5:
34: * @param JsonSchema $propertiesStructure
35: * @param string $propertyName
36: *
37: * @throws SchemaException
38: */
39: public function __construct(
40: SchemaProcessor $schemaProcessor,
41: Schema $schema,
42: JsonSchema $propertiesStructure,
43: string $propertyName,
44: ) {
^
45: $propertyFactory = new PropertyFactory(new PropertyProcessorFactory());
46:
47: $this->tupleProperties = [];
48:
49: foreach ($propertiesStructure->getJson() as $tupleIndex => $tupleItem) {
50: $tupleItemName = "tuple item #$tupleIndex of array $propertyName";
51:
52: // an item of the array behaves like a nested property to add item-level validation
53: $tupleProperty = $propertyFactory->create(
54: new PropertyMetaDataCollection([$tupleItemName]),
ERROR: Unable to parse file: /code/src/Model/Validator/NoAdditionalPropertiesValidator.php
ERROR: Parse error at line 37 column 9:
27:
28: parent::__construct(
29: $property,
30: DIRECTORY_SEPARATOR . 'Validator' . DIRECTORY_SEPARATOR . 'NoAdditionalProperties.phptpl',
31: [
32: 'properties' => RenderHelper::varExportArray(array_keys($json['properties'] ?? [])),
33: 'pattern' => addcslashes(join('|', array_keys($json['patternProperties'] ?? [])), "'/"),
34: ],
35: AdditionalPropertiesException::class,
36: ['&$additionalProperties'],
37: );
^
38: }
39: }
40:
ERROR: Unable to parse file: /code/src/Model/Validator/PropertyValidator.php
ERROR: Parse error at line 32 column 5:
22: * @param PropertyInterface $property
23: * @param string $check
24: * @param string $exceptionClass
25: * @param array $exceptionParams
26: */
27: public function __construct(
28: PropertyInterface $property,
29: string $check,
30: string $exceptionClass,
31: array $exceptionParams = [],
32: ) {
^
33: $this->isResolved = true;
34: $this->check = $check;
35:
36: parent::__construct($property, $exceptionClass, $exceptionParams);
37: }
38:
39: /**
40: * Get the source code for the check to perform
41: *
42: * @return string
ERROR: Unable to parse file: /code/src/Model/Validator/ConditionalPropertyValidator.php
ERROR: Parse error at line 24 column 5:
14: *
15: * @package PHPModelGenerator\Model\Validator
16: */
17: class ConditionalPropertyValidator extends AbstractComposedPropertyValidator
18: {
19: public function __construct(
20: GeneratorConfiguration $generatorConfiguration,
21: PropertyInterface $property,
22: array $composedProperties,
23: array $validatorVariables,
24: ) {
^
25: $this->isResolved = true;
26:
27: parent::__construct(
28: $generatorConfiguration,
29: $property,
30: DIRECTORY_SEPARATOR . 'Validator' . DIRECTORY_SEPARATOR . 'ConditionalComposedItem.phptpl',
31: $validatorVariables,
32: ConditionalException::class,
33: ['&$ifException', '&$thenException', '&$elseException'],
34: );
ERROR: Unable to parse file: /code/src/Model/Validator/PropertyDependencyValidator.php
ERROR: Parse error at line 36 column 9:
26: $this->isResolved = true;
27:
28: parent::__construct(
29: $property,
30: DIRECTORY_SEPARATOR . 'Validator' . DIRECTORY_SEPARATOR . 'PropertyDependency.phptpl',
31: [
32: 'dependencies' => RenderHelper::varExportArray(array_values($dependencies)),
33: ],
34: InvalidPropertyDependencyException::class,
35: ['&$missingAttributes'],
36: );
^
37: }
38:
39: /**
40: * Initialize all variables which are required to execute a property names validator
41: *
42: * @return string
43: */
44: public function getValidatorSetUp(): string
45: {
46: return '$missingAttributes = [];';
ERROR: Unable to parse file: /code/src/Model/Validator/ExtractedMethodValidator.php
ERROR: Parse error at line 30 column 5:
20: /** @var GeneratorConfiguration */
21: private $generatorConfiguration;
22:
23: public function __construct(
24: GeneratorConfiguration $generatorConfiguration,
25: PropertyInterface $property,
26: string $template,
27: array $templateValues,
28: string $exceptionClass,
29: array $exceptionParams = [],
30: ) {
^
31: $this->generatorConfiguration = $generatorConfiguration;
32:
33: $this->extractedMethodName = sprintf(
34: 'validate%s_%s_%s',
35: str_replace(' ', '', ucfirst($property->getAttribute())),
36: str_replace('Validator', '', substr(strrchr(static::class, '\\'), 1)),
37: uniqid(),
38: );
39:
40: parent::__construct($property, $template, $templateValues, $exceptionClass, $exceptionParams);
ERROR: Unable to parse file: /code/src/Model/Validator/SchemaDependencyValidator.php
ERROR: Parse error at line 48 column 21:
38: DIRECTORY_SEPARATOR . 'Validator' . DIRECTORY_SEPARATOR . 'SchemaDependency.phptpl',
39: [
40: 'viewHelper' => new RenderHelper($schemaProcessor->getGeneratorConfiguration()),
41: 'generatorConfiguration' => $schemaProcessor->getGeneratorConfiguration(),
42: 'transferProperties' => $schema->getProperties(),
43: // set up a helper property for handling of the nested object
44: 'nestedProperty' => (new Property("{$property->getName()}Dependency", null, $schema->getJsonSchema()))
45: ->addDecorator(new ObjectInstantiationDecorator(
46: $schema->getClassName(),
47: $schemaProcessor->getGeneratorConfiguration(),
48: ))
^
49: ],
50: InvalidSchemaDependencyException::class,
51: ['&$dependencyException'],
52: );
53: }
54:
55: /**
56: * Initialize all variables which are required to execute a property names validator
57: *
58: * @return string
ERROR: Unable to parse file: /code/src/Model/Validator/FilterValidator.php
ERROR: Parse error at line 48 column 5:
38: *
39: * @throws SchemaException
40: * @throws ReflectionException
41: */
42: public function __construct(
43: GeneratorConfiguration $generatorConfiguration,
44: FilterInterface $filter,
45: PropertyInterface $property,
46: array $filterOptions = [],
47: ?TransformingFilterInterface $transformingFilter = null,
48: ) {
^
49: $this->isResolved = true;
50:
51: $this->filter = $filter;
52: $this->filterOptions = $filterOptions;
53:
54: $transformingFilter === null
55: ? $this->validateFilterCompatibilityWithBaseType($filter, $property)
56: : $this->validateFilterCompatibilityWithTransformedType($filter, $transformingFilter, $property);
57:
58: parent::__construct(
ERROR: Unable to parse file: /code/src/Model/Validator/TypeCheckValidator.php
ERROR: Parse error at line 36 column 9:
26: */
27: public function __construct(string $type, PropertyInterface $property, bool $allowImplicitNull)
28: {
29: $this->type = strtolower($type);
30:
31: parent::__construct(
32: $property,
33: "!is_$type(\$value)" . ($allowImplicitNull ? ' && $value !== null' : ''),
34: InvalidTypeException::class,
35: [$type],
36: );
^
37: }
38:
39: /**
40: * @inheritDoc
41: */
42: public function getTypes(): array
43: {
44: return [$this->type];
45: }
46: }
ERROR: Unable to parse file: /code/src/Model/Validator/EnumValidator.php
ERROR: Parse error at line 31 column 9:
21: * @param PropertyInterface $property
22: * @param array $allowedValues
23: */
24: public function __construct(PropertyInterface $property, array $allowedValues)
25: {
26: parent::__construct(
27: $property,
28: '!in_array($value, ' . RenderHelper::varExportArray($allowedValues) . ', true)',
29: EnumException::class,
30: [$allowedValues],
31: );
^
32: }
33: }
34:
ERROR: Unable to parse file: /code/src/Model/Validator/PropertyNamesValidator.php
ERROR: Parse error at line 38 column 5:
28: * @param SchemaProcessor $schemaProcessor
29: * @param Schema $schema
30: * @param JsonSchema $propertiesNames
31: *
32: * @throws SchemaException
33: */
34: public function __construct(
35: SchemaProcessor $schemaProcessor,
36: Schema $schema,
37: JsonSchema $propertiesNames,
38: ) {
^
39: $this->isResolved = true;
40:
41: $nameValidationProperty = (new StringProcessor(new PropertyMetaDataCollection(), $schemaProcessor, $schema))
42: ->process('property name', $propertiesNames)
43: // the property name validator doesn't need type checks or required checks so simply filter them out
44: ->filterValidators(static function (Validator $validator): bool {
45: return !is_a($validator->getValidator(), RequiredPropertyValidator::class) &&
46: !is_a($validator->getValidator(), TypeCheckValidator::class);
47: });
48:
ERROR: Unable to parse file: /code/src/Model/Validator/FormatValidator.php
ERROR: Parse error at line 33 column 5:
23: * FormatValidator constructor.
24: *
25: * @param PropertyInterface $property
26: * @param FormatValidatorInterface $validator
27: * @param array $exceptionParams
28: */
29: public function __construct(
30: PropertyInterface $property,
31: FormatValidatorInterface $validator,
32: array $exceptionParams = [],
33: ) {
^
34: $this->isResolved = true;
35: $this->validator = $validator;
36:
37: parent::__construct($property, FormatException::class, $exceptionParams);
38: }
39:
40: /**
41: * Get the source code for the check to perform
42: *
43: * @return string
ERROR: Unable to parse file: /code/src/Model/GeneratorConfiguration.php
ERROR: Parse error at line 81 column 13:
71: *
72: * @throws Exception
73: * @throws InvalidFilterException
74: */
75: public function addFilter(FilterInterface ...$additionalFilter): self
76: {
77: foreach ($additionalFilter as $filter) {
78: $this->validateFilterCallback(
79: $filter->getFilter(),
80: "Invalid filter callback for filter {$filter->getToken()}",
81: );
^
82:
83: if ($filter instanceof TransformingFilterInterface) {
84: $this->validateFilterCallback(
85: $filter->getSerializer(),
86: "Invalid serializer callback for filter {$filter->getToken()}"
87: );
88: }
89:
90: foreach ($filter->getAcceptedTypes() as $acceptedType) {
91: if (!in_array($acceptedType, ['integer', 'number', 'boolean', 'string', 'array', 'null']) &&
ERROR: Unable to parse file: /code/src/Model/RenderJob.php
ERROR: Parse error at line 46 column 5:
36: * @param string $fileName The file name
37: * @param string $classPath The relative path of the class for namespace generation
38: * @param string $className The class name
39: * @param Schema $schema The Schema object which holds properties and validators
40: */
41: public function __construct(
42: string $fileName,
43: string $classPath,
44: string $className,
45: Schema $schema,
46: ) {
^
47: $this->fileName = $fileName;
48: $this->classPath = $classPath;
49: $this->className = $className;
50: $this->schema = $schema;
51: }
52:
53: /**
54: * @param PostProcessor[] $postProcessors
55: * @param GeneratorConfiguration $generatorConfiguration
56: */
ERROR: Unable to parse file: /code/src/Model/Schema.php
ERROR: Parse error at line 79 column 5:
69: * @param JsonSchema $schema
70: * @param SchemaDefinitionDictionary|null $dictionary
71: * @param bool $initialClass
72: */
73: public function __construct(
74: string $classPath,
75: string $className,
76: JsonSchema $schema,
77: ?SchemaDefinitionDictionary $dictionary = null,
78: bool $initialClass = false,
79: ) {
^
80: $this->className = $className;
81: $this->classPath = $classPath;
82: $this->jsonSchema = $schema;
83: $this->schemaDefinitionDictionary = $dictionary ?? new SchemaDefinitionDictionary('');
84: $this->description = $schema->getJson()['description'] ?? '';
85: $this->initialClass = $initialClass;
86:
87: $this->addInterface(JSONModelInterface::class);
88: }
89:
ERROR: Unable to parse file: /code/src/SchemaProcessor/PostProcessor/Internal/ExtendObjectPropertiesMatchingPatternPropertiesPostProcessor.php
ERROR: Parse error at line 71 column 21:
61: }
62:
63: // TODO: extract pattern property validation from the base validator into a separate method and
64: // TODO: call only the pattern property validation at this location to avoid executing unnecessary
65: // TODO: validators
66: return sprintf('
67: $modelData = array_merge($this->_rawModelDataInput, ["%s" => $value]);
68: $this->executeBaseValidators($modelData);
69: ',
70: $property->getName(),
71: );
^
72: }
73: },
74: );
75: }
76:
77: /**
78: * @param Schema $schema
79: * @param GeneratorConfiguration $generatorConfiguration
80: *
81: * @throws SchemaException
ERROR: Unable to parse file: /code/src/SchemaProcessor/PostProcessor/Internal/SerializationPostProcessor.php
ERROR: Parse error at line 67 column 5:
57: /**
58: * Each transforming filter must provide a method to serialize the value. Add a method to the schema to call the
59: * serialization for each property with a transforming filter
60: *
61: * @param Schema $schema
62: * @param GeneratorConfiguration $generatorConfiguration
63: */
64: private function addSerializeFunctionsForTransformingFilters(
65: Schema $schema,
66: GeneratorConfiguration $generatorConfiguration,
67: ): void {
^
68: foreach ($schema->getProperties() as $property) {
69: foreach ($property->getValidators() as $validator) {
70: $validator = $validator->getValidator();
71:
72: if ($validator instanceof FilterValidator &&
73: $validator->getFilter() instanceof TransformingFilterInterface
74: ) {
75: [$serializerClass, $serializerMethod] = $validator->getFilter()->getSerializer();
76:
77: $schema->addMethod(
ERROR: Unable to parse file: /code/src/SchemaProcessor/PostProcessor/Internal/PatternPropertiesPostProcessor.php
ERROR: Parse error at line 49 column 21:
39: $patternHashes = [];
40: $schemaProperties = array_keys($json['properties'] ?? []);
41:
42: foreach ($schema->getBaseValidators() as $validator) {
43: if (is_a($validator, PatternPropertiesValidator::class)) {
44: if (array_key_exists($validator->getKey(), $patternHashes)) {
45: $key = $json['patternProperties'][$validator->getPattern()]['key'] ?? $validator->getPattern();
46:
47: throw new SchemaException(
48: "Duplicate pattern property access key '$key' in file {$schema->getJsonSchema()->getFile()}",
49: );
^
50: }
51:
52: $patternHashes[$validator->getKey()] = array_reduce(
53: $schema->getProperties(),
54: static function (
55: array $carry,
56: PropertyInterface $property,
57: ) use ($schemaProperties, $validator): array {
58: if (in_array($property->getName(), $schemaProperties) &&
59: preg_match('/' . addcslashes($validator->getPattern(), '/') . '/', $property->getName())
ERROR: Unable to parse file: /code/src/SchemaProcessor/PostProcessor/Internal/CompositionValidationPostProcessor.php
ERROR: Parse error at line 90 column 17:
80: }
81: }
82:
83: if (!empty($validatorPropertyMap)) {
84: $schema->addProperty(
85: (new Property(
86: 'propertyValidationState',
87: new PropertyType('array'),
88: new JsonSchema(__FILE__, []),
89: 'Track the internal validation state of composed validations',
90: ))
^
91: ->setInternal(true)
92: ->setDefaultValue(
93: array_fill_keys(
94: array_unique(
95: array_merge(...array_values($validatorPropertyMap)),
96: ),
97: [],
98: )
99: ),
100: );
ERROR: Unable to parse file: /code/src/SchemaProcessor/PostProcessor/Internal/AdditionalPropertiesPostProcessor.php
ERROR: Parse error at line 62 column 9:
52: $validator->setCollectAdditionalProperties(true);
53: $validationProperty = $validator->getValidationProperty();
54: }
55: }
56:
57: $additionalPropertiesCollectionProperty = (new Property(
58: 'additionalProperties',
59: new PropertyType('array'),
60: new JsonSchema(__FILE__, []),
61: 'Collect all additional properties provided to the schema',
62: ))
^
63: ->setDefaultValue([])
64: ->setInternal(true);
65:
66: if ($validationProperty) {
67: $additionalPropertiesCollectionProperty->addTypeHintDecorator(
68: new ArrayTypeHintDecorator($validationProperty),
69: );
70: }
71:
72: $schema->addProperty($additionalPropertiesCollectionProperty);
ERROR: Unable to parse file: /code/src/SchemaProcessor/PostProcessor/RenderedMethod.php
ERROR: Parse error at line 40 column 5:
30: /** @var string */
31: private $template;
32: /** @var array */
33: private $templateValues;
34:
35: public function __construct(
36: Schema $schema,
37: GeneratorConfiguration $generatorConfiguration,
38: string $template,
39: array $templateValues = [],
40: ) {
^
41: $this->schema = $schema;
42: $this->generatorConfiguration = $generatorConfiguration;
43: $this->template = $template;
44: $this->templateValues = $templateValues;
45: }
46:
47: /**
48: * @inheritDoc
49: *
50: * @throws FileSystemException
ERROR: Unable to parse file: /code/src/SchemaProcessor/PostProcessor/EnumPostProcessor.php
ERROR: Parse error at line 54 column 5:
44: * @param string $namespace The namespace for the generated enums
45: * @param bool $skipNonMappedEnums By default, enums which not contain only strings and don't provide a mapping for
46: * the enum will throw an exception. If set to true, those enums will be skipped
47: *
48: * @throws Exception
49: */
50: public function __construct(
51: string $targetDirectory,
52: string $namespace,
53: bool $skipNonMappedEnums = false,
54: ) {
^
55: if (PHP_VERSION_ID < 80100) {
56: // @codeCoverageIgnoreStart
57: throw new Exception('Enumerations are only allowed since PHP 8.1');
58: // @codeCoverageIgnoreEnd
59: }
60:
61: (new ModelGenerator())->generateModelDirectory($targetDirectory);
62:
63: $this->renderer = new Render(__DIR__ . DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR);
64: $this->namespace = trim($namespace, '\\');
ERROR: Unable to parse file: /code/src/SchemaProcessor/PostProcessor/PatternPropertiesAccessorPostProcessor.php
ERROR: Parse error at line 59 column 5:
49: * Adds a method to get a list of pattern properties by property key or pattern
50: *
51: * @param Schema $schema
52: * @param GeneratorConfiguration $generatorConfiguration
53: * @param PropertyType[] $patternTypes
54: */
55: private function addGetPatternPropertiesMethod(
56: Schema $schema,
57: GeneratorConfiguration $generatorConfiguration,
58: array $patternTypes,
59: ): void {
^
60: $schema
61: ->addUsedClass(UnknownPatternPropertyException::class)
62: ->addMethod(
63: 'getPatternProperties',
64: new RenderedMethod(
65: $schema,
66: $generatorConfiguration,
67: 'PatternProperties/GetPatternProperties.phptpl',
68: [
69: 'returnTypeAnnotation' => $this->getReturnTypeAnnotationForGetPatternProperties($patternTypes),
ERROR: Unable to parse file: /code/src/SchemaProcessor/PostProcessor/AdditionalPropertiesAccessorPostProcessor.php
ERROR: Parse error at line 104 column 5:
94: * Adds a method to add or update an additional property
95: *
96: * @param Schema $schema
97: * @param GeneratorConfiguration $generatorConfiguration
98: * @param PropertyInterface|null $validationProperty
99: */
100: private function addSetAdditionalPropertyMethod(
101: Schema $schema,
102: GeneratorConfiguration $generatorConfiguration,
103: ?PropertyInterface $validationProperty,
104: ): void {
^
105: $objectProperties = RenderHelper::varExportArray(
106: array_map(
107: static function (PropertyInterface $property): string {
108: return $property->getName();
109: },
110: array_filter(
111: $schema->getProperties(),
112: static function (PropertyInterface $property): bool {
113: return !$property->isInternal();
114: },
ERROR: Unable to parse file: /code/src/SchemaProcessor/PostProcessor/PopulatePostProcessor.php
ERROR: Parse error at line 30 column 13:
20: $schema->addMethod(
21: 'populate',
22: new RenderedMethod(
23: $schema,
24: $generatorConfiguration,
25: 'Populate.phptpl',
26: [
27: 'schemaHookResolver' => new SchemaHookResolver($schema),
28: 'true' => true,
29: ],
30: )
^
31: );
32: }
33: }
34:
ERROR: Unable to parse file: /code/src/SchemaProcessor/SchemaProcessor.php
ERROR: Parse error at line 65 column 5:
55: * @param string $baseSource
56: * @param string $destination
57: * @param GeneratorConfiguration $generatorConfiguration
58: * @param RenderQueue $renderQueue
59: */
60: public function __construct(
61: string $baseSource,
62: string $destination,
63: GeneratorConfiguration $generatorConfiguration,
64: RenderQueue $renderQueue,
65: ) {
^
66: $this->baseSource = $baseSource;
67: $this->destination = $destination;
68: $this->generatorConfiguration = $generatorConfiguration;
69: $this->renderQueue = $renderQueue;
70: }
71:
72: /**
73: * Process a given json schema file
74: *
75: * @param JsonSchema $jsonSchema
ERROR: Unable to parse file: /code/src/SchemaProcessor/Hook/SchemaHookResolver.php
ERROR: Parse error at line 57 column 9:
47: return $this->resolveHook(SerializationHookInterface::class);
48: }
49:
50: private function getHooks(string $filterHook): array
51: {
52: return array_filter(
53: $this->schema->getSchemaHooks(),
54: static function (SchemaHookInterface $hook) use ($filterHook): bool {
55: return is_a($hook, $filterHook);
56: },
57: );
^
58: }
59:
60: private function resolveHook(string $filterHook, ...$parameters): string
61: {
62: return join(
63: "\n\n",
64: array_map(static function ($hook) use ($parameters): string {
65: return $hook->getCode(...$parameters);
66: }, $this->getHooks($filterHook)),
67: );
INFO: 130/130 source files have been analyzed
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.931s
INFO: Final Memory: 10M/95M
INFO: ------------------------------------------------------------------------
|