You are reviewing a pull request for a coworker’s new module and see the following snippet in a class:
try {
$bankData = [];
foreach ($bankAccounts as $bank) {
$bankData[] = $bank->getData();
}
return $bankData;
} catch (\Exception $e) {
return [
'error' => sprintf('Error ... customer ID %1', $customerId),
'message' => $e->getMessage()
];
}
❓ What change(s) do you request before approving the work to be merged?
ℹ️ Looking for ways to improve code during a review?
Keeping code as concise and simple as possible should be a top priority. And, keep an eye out for areas that may have slipped by dev testing, like logging. If the code doesn’t break “properly”, it can be incredibly hard to debug later on.
---
Connect with Joseph:
LinkedIn: / maxwelljoseph
Twitter: / swiftotter_joe
https://swiftotter.com
/ swift_otter
/ swiftotterinc
Have you joined the free SwiftOtter Slack community? It's exploding and we don't want you to miss out. Go to https://swiftotter.com/slack to join for free and get plugged into what might be the best group of collaborating developers around!