PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
← All changes | vendor/wordpress/php-mcp-schema/src/Common/Traits/ValidatesRequiredFields.php +18 -0 2.3.0 → trunk View file →
@@ -184,8 +184,26 @@
184 184 return $value === null ? null : self::asArray($value);
185 185 }
186 186
187 187 /**
188 + * Returns the entries of $data whose keys the caller does not model.
189 + *
190 + * Used by types the MCP schema declares open (`[key: string]: unknown`),
191 + * so that unrecognized fields survive a fromArray()/toArray() round trip
192 + * instead of being silently discarded.
193 + *
194 + * @param array<string, mixed> $data
195 + * @param array<int, string> $known
196 + * @return array<string, mixed>|null
197 + */
198 + protected static function additionalFields(array $data, array $known): ?array
199 + {
200 + $additional = array_diff_key($data, array_flip($known));
201 +
202 + return $additional === [] ? null : $additional;
203 + }
204 +
205 + /**
188 206 * Asserts a value is an object and returns it.
189 207 *
190 208 * Accepts both PHP arrays and objects, auto-converting arrays to objects.
191 209 * This aligns with MCP spec where JSON objects can be PHP arrays or objects.