Skip to content

Commit ece7534

Browse files
committed
Fixes for nested compositions
1 parent cb0bb6e commit ece7534

20 files changed

+59
-29
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
},
2626
"autoload-dev": {
2727
"psr-4": {
28-
"PHPModelGenerator\\Tests\\": "tests"
28+
"PHPModelGenerator\\Tests\\": "tests",
29+
"ManualSchema\\": "tests/manual/result"
2930
}
3031
}
3132
}

src/Model/Property/Property.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ public function getValidators(): array
122122
/**
123123
* @inheritdoc
124124
*/
125-
public function filterValidators(callable $filter): void
125+
public function filterValidators(callable $filter): PropertyInterface
126126
{
127127
$this->validator = array_filter($this->validator, $filter);
128+
129+
return $this;
128130
}
129131

130132
/**

src/Model/Property/PropertyInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ public function getValidators(): array;
7373
* Filter the assigned validators
7474
*
7575
* @param callable $filter
76+
*
77+
* @return PropertyInterface
7678
*/
77-
public function filterValidators(callable $filter): void;
79+
public function filterValidators(callable $filter): PropertyInterface;
7880

7981
/**
8082
* Retrieve all added validators ordered by priority

src/Model/Property/PropertyProxy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ public function getValidators(): array
110110
/**
111111
* @inheritdoc
112112
*/
113-
public function filterValidators(callable $filter): void
113+
public function filterValidators(callable $filter): PropertyInterface
114114
{
115-
$this->getProperty()->filterValidators($filter);
115+
return $this->getProperty()->filterValidators($filter);
116116
}
117117

118118
/**

src/Model/RenderJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types=1);
3+
declare(strict_types = 1);
44

55
namespace PHPModelGenerator\Model;
66

src/Model/ResolvedDefinitionsCollection.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
namespace PHPModelGenerator\Model;
46

57
class ResolvedDefinitionsCollection

src/Model/Schema.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function getProperties(): array
4747
*
4848
* @throws SchemaException
4949
*/
50-
public function addProperty(PropertyInterface $property)
50+
public function addProperty(PropertyInterface $property): self
5151
{
5252
if (isset($this->properties[$property->getName()])) {
5353
throw new SchemaException("Duplicate object property {$property->getName()}");
@@ -116,15 +116,17 @@ public function getUseList(bool $skipGlobalNamespace): array
116116
* @param string $key
117117
* @param SchemaDefinition $definition
118118
*
119-
* @throws SchemaException
119+
* @return Schema
120120
*/
121-
public function addDefinition(string $key, SchemaDefinition $definition)
121+
public function addDefinition(string $key, SchemaDefinition $definition): self
122122
{
123123
if (isset($this->definitions[$key])) {
124-
return;
124+
return $this;
125125
}
126126

127127
$this->definitions[$key] = $definition;
128+
129+
return $this;
128130
}
129131

130132
/**

src/Model/SchemaDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types=1);
3+
declare(strict_types = 1);
44

55
namespace PHPModelGenerator\Model;
66

src/Model/Validator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
namespace PHPModelGenerator\Model;
46

57
use PHPModelGenerator\Model\Validator\PropertyValidatorInterface;

src/Model/Validator/AbstractPropertyValidator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
namespace PHPModelGenerator\Model\Validator;
46

57
/**
68
* Class AbstractPropertyValidator
79
*
810
* @package PHPModelGenerator\Model\Validator
911
*/
10-
abstract class AbstractPropertyValidator
12+
abstract class AbstractPropertyValidator implements PropertyValidatorInterface
1113
{
1214
/** @var string */
1315
protected $exceptionClass;

0 commit comments

Comments
 (0)