Skip to content

Commit cd1fe73

Browse files
committed
Null coalesce nullable fields
1 parent 27fd2f7 commit cd1fe73

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

src/Capability/Registry/Loader/ArrayLoader.php

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,14 @@ public function load(ReferenceRegistryInterface $registry): void
149149
}
150150

151151
$resource = new Resource(
152-
$data['uri'],
153-
$name,
154-
$description,
155-
$data['mimeType'],
156-
$data['annotations'],
157-
$data['size'],
158-
$data['icons'],
159-
$data['meta'],
152+
uri: $data['uri'],
153+
name: $name,
154+
description: $description,
155+
mimeType: $data['mimeType'] ?? null,
156+
annotations: $data['annotations'] ?? null,
157+
size: $data['size'] ?? null,
158+
icons: $data['icons'] ?? null,
159+
meta: $data['meta'] ?? null,
160160
);
161161
$registry->registerResource($resource, $data['handler'], true);
162162

@@ -189,12 +189,12 @@ public function load(ReferenceRegistryInterface $registry): void
189189
}
190190

191191
$template = new ResourceTemplate(
192-
$data['uriTemplate'],
193-
$name,
194-
$description,
195-
$data['mimeType'],
196-
$data['annotations'],
197-
$data['meta'],
192+
uriTemplate: $data['uriTemplate'],
193+
name: $name,
194+
description: $description,
195+
mimeType: $data['mimeType'] ?? null,
196+
annotations: $data['annotations'] ?? null,
197+
meta: $data['meta'] ?? null,
198198
);
199199
$completionProviders = $this->getCompletionProviders($reflection);
200200
$registry->registerResourceTemplate($template, $data['handler'], $completionProviders, true);
@@ -246,7 +246,13 @@ public function load(ReferenceRegistryInterface $registry): void
246246
!$param->isOptional() && !$param->isDefaultValueAvailable(),
247247
);
248248
}
249-
$prompt = new Prompt($name, $description, $arguments, $data['icons'], $data['meta']);
249+
$prompt = new Prompt(
250+
name: $name,
251+
description: $description,
252+
arguments: $arguments,
253+
icons: $data['icons'] ?? null,
254+
meta: $data['meta'] ?? null
255+
);
250256
$completionProviders = $this->getCompletionProviders($reflection);
251257
$registry->registerPrompt($prompt, $data['handler'], $completionProviders, true);
252258

0 commit comments

Comments
 (0)