Skip to content

Commit b2a62df

Browse files
committed
update parameter.php
1 parent ccdc3d9 commit b2a62df

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

camel/Extraction/Parameter.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,25 @@
22

33
namespace Knuckles\Camel\Extraction;
44

5-
65
use Knuckles\Camel\BaseDTO;
76

87
class Parameter extends BaseDTO
98
{
109
public string $name;
11-
public ?string $description = null;
10+
public string $description = '';
1211
public bool $required = false;
1312
public mixed $example = null;
14-
public string $type = 'string';
13+
public ?string $type = null;
1514
public array $enumValues = [];
15+
public array $custom = [];
1616
public bool $exampleWasSpecified = false;
1717
public bool $nullable = false;
1818

19-
public function __construct(array $parameters = [])
19+
public static function create(BaseDTO|array $data, BaseDTO|array $inheritFrom = []): static
2020
{
21-
unset($parameters['setter']);
22-
parent::__construct($parameters);
21+
$dataArray = is_array($data) ? $data : $data->toArray();
22+
$inheritFromArray = is_array($inheritFrom) ? $inheritFrom : $inheritFrom->toArray();
23+
$merged = array_merge($inheritFromArray, $dataArray);
24+
return new static($merged);
2325
}
2426
}

0 commit comments

Comments
 (0)