Skip to content

Commit

Permalink
added path to Context::$dynamics
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Oct 3, 2023
1 parent 92e3f68 commit f99adc9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Schema/Elements/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function complete($value, Context $context)

if ($value instanceof DynamicParameter) {
$expected = $this->type . ($this->range === [null, null] ? '' : ':' . implode('..', $this->range));
$context->dynamics[] = [$value, str_replace(DynamicParameter::class . '|', '', $expected)];
$context->dynamics[] = [$value, str_replace(DynamicParameter::class . '|', '', $expected), $context->path];
}

if ($this->itemsValue) {
Expand Down
4 changes: 4 additions & 0 deletions tests/Schema/Expect.dynamic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,22 @@ test('', function () {
[
new DynamicParameter("\$this->parameters['foo']"),
'string',
['a'],
],
[
new DynamicParameter("\$this->parameters['bar']"),
'string',
['b'],
],
[
new DynamicParameter("\$this->parameters['int']"),
'int:10..20',
['d'],
],
[
new DynamicParameter("\$this->parameters['baz']"),
'int',
['arr', 'x'],
],
],
$context->dynamics
Expand Down

0 comments on commit f99adc9

Please sign in to comment.