To resolve the warning, you can check if the key exists in the array before attempting to access it, using the isset() function.
Instead of directly returning the value using the locationId key, implement a conditional check: if(isset($warehouseMapArray[$locationId])) return $warehouseMapArray[$locationId]; else return null;
Collection
[
|
...
]