A supplier who renamed four response fields in a patch release, twice in two years, with the second one costing an afternoon instead of a week.
// one file. the only place that knows their names.
final class SupplierOrderMapper
{
public function toConsignment(array $payload): Consignment
{
return new Consignment(
reference: $payload['consignmentRef'] ?? $payload['consignment_ref'],
weight: Weight::grams($payload['weightGrams']),
status: $this->status($payload['statusCode']),
);
}
}
The null-coalescing pair is deliberate and temporary — it accepts both spellings during the window where their systems disagree with each other, with a comment carrying a removal date. What the layer does not do is make the change free: the mapping still has to be updated, and the gain is that it is updated in one file with one test rather than in twenty-two.