diff --git a/src/JsonMapper/Converter/CamelCasePropertyNameConverter.php b/src/JsonMapper/Converter/CamelCasePropertyNameConverter.php index 38ba03a..63eacff 100644 --- a/src/JsonMapper/Converter/CamelCasePropertyNameConverter.php +++ b/src/JsonMapper/Converter/CamelCasePropertyNameConverter.php @@ -25,11 +25,23 @@ { private Inflector $inflector; + /** + * Creates the converter with the Doctrine inflector responsible for camel case transformations. + * + * The inflector dependency is initialised here so it can be reused for every conversion. + */ public function __construct() { $this->inflector = InflectorFactory::create()->build(); } + /** + * Converts a raw JSON property name to the camelCase variant expected by PHP properties. + * + * @param string $name Raw property name as provided by the JSON payload. + * + * @return string Normalised camelCase property name that matches PHP naming conventions. + */ public function convert(string $name): string { return $this->inflector->camelize($name); diff --git a/src/JsonMapper/Converter/PropertyNameConverterInterface.php b/src/JsonMapper/Converter/PropertyNameConverterInterface.php index 80c3c28..de5097d 100644 --- a/src/JsonMapper/Converter/PropertyNameConverterInterface.php +++ b/src/JsonMapper/Converter/PropertyNameConverterInterface.php @@ -23,9 +23,9 @@ interface PropertyNameConverterInterface /** * Convert the specified JSON property name to its PHP property name. * - * @param string $name + * @param string $name Raw property name exactly as it appears in the JSON structure. * - * @return string + * @return string Normalised PHP property name that matches the target object's naming scheme. */ public function convert(string $name): string; }