You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Service methods that return null would allow using PHP 8 nullsafe operator, without the need to providing correct dates.
Example (current behavior)
$currencyAverages = CurrencyAverageRatesService::create();
// throws exeption, because there is no trading data available for this day:$currencyAverages->formDay('2023-01-01');
Example (new behavior)
$currencyAverages = CurrencyAverageRatesService::create();
// returns null instead of throwing exception, so can be safely chained:$currencyAverages->formDay('2023-01-01')?->fromTable('A')->getRate('USD');
Todo
Decide whether or not to implement this in old API (causes BC-break), or add new API
Possible aproaches for the new API solution
Introduce methods in existing services (for example tryFromDay('2023-01-01')
Introduce new api classes corresponding to existing ones (something like CurrencyAverageRatesService -> CurrencyAverageRatesNullableService)
Introduce some kind of switch (config variable) in existing services to change the behavior of existing methods. No BC-break, but breaks SOLID.
The text was updated successfully, but these errors were encountered:
Service methods that return
null
would allow using PHP 8 nullsafe operator, without the need to providing correct dates.Example (current behavior)
Example (new behavior)
Todo
Possible aproaches for the new API solution
tryFromDay('2023-01-01')
CurrencyAverageRatesService
->CurrencyAverageRatesNullableService
)The text was updated successfully, but these errors were encountered: