php-try
php-try copied to clipboard
Try type for PHP
Results
4
php-try issues
Sort by
recently updated
recently updated
newest added
fix typo? does not make sense otherwise!
What initially struck me as confusing was that the API naming made it felt like a Promise. Successes and failures are conceptually results (or outcomes), not attempts, and the "on*"...
Not returning $this kinda breaks an implicit contract, but I think a note here would suffice. It shouldn't break code that uses the library as directed.
I've some suggestions for the API after trying this a bit. Basically, I'm wondering what you think about something like this: ``` php Attempt::call($someCallable) ->forAll($onSuccess) ->always($always) // Finally semantics (called...