Object Oriented Design — Exceptions

/**
* @return string|false
*/
public function process(string $value)
{
if ($value === '') {
return false;
}

// some something with string

return $processedString
}
  1. Surround with try/catch (and re-throw the exception with another that is specific to the Catalog)
  2. Add a @throws tag to the method annotation

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store