Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public function create(string $resourceClass): ResourceMetadataCollection
/**
* @return array{propertyNames: string[], properties: array<string, ApiProperty>}
*/
private function getProperties(string $resourceClass, ?Parameter $parameter = null): array
private function getProperties(string $resourceClass, ?Parameter $parameter = null, ?string $key = null): array
{
$k = $resourceClass.($parameter?->getProperties() ? ($parameter->getKey() ?? '') : '');
$k = $resourceClass.($parameter?->getProperties() ? ($parameter->getKey() ?? ($key ?? '')) : '');
if (isset($this->localPropertyCache[$k])) {
return $this->localPropertyCache[$k];
}
Expand All @@ -120,7 +120,7 @@ private function getDefaultParameters(Operation $operation, string $resourceClas
$propertyNames = $properties = [];
$parameters = $operation->getParameters() ?? new Parameters();
foreach ($parameters as $key => $parameter) {
['propertyNames' => $propertyNames, 'properties' => $properties] = $this->getProperties($resourceClass, $parameter);
['propertyNames' => $propertyNames, 'properties' => $properties] = $this->getProperties($resourceClass, $parameter, $key);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What bother's me is that a parameter should always have akey, would it be possible to change the loop and do:

foreach ($parameters as $key => $parameter) {
    if (!$parameter->getKey()) {
        $parameter = $parameter->withKey($key);
    }

if (null === $parameter->getProvider() && (($f = $parameter->getFilter()) && $f instanceof ParameterProviderFilterInterface)) {
$parameters->add($key, $parameter->withProvider($f->getParameterProvider()));
}
Expand Down
Loading