Skip to content

cleanup phpdoc and BatchResult interface #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2015
Merged

cleanup phpdoc and BatchResult interface #73

merged 1 commit into from
Oct 23, 2015

Conversation

dbu
Copy link
Contributor

@dbu dbu commented Oct 23, 2015

mainly adjusting the exceptions, but i also went over the BatchResult interface. we had duplicated methods and i reordered them to be consistent.

isSuccessful and hasResponseFor are the same
as are isFailed and hasExceptionFor

i went with isSuccessful and isFailed, but maybe hasExceptionFor / hasResponseFor would be more straightforward. wdyt?

@@ -9,6 +9,6 @@
*
* @author Márk Sági-Kazár <[email protected]>
*/
class TransferException extends \RuntimeException implements Exception
abstract class TransferException extends \RuntimeException implements Exception
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we never need to directly instantiate this exception. or do we?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think so.

@sagikazarmark
Copy link
Member

I think isSuccessful and isFailed are better from a domain point of view. We are curious about if the request was successful or failed after all.

@dbu
Copy link
Contributor Author

dbu commented Oct 23, 2015

BatchException never neds to have a previous exception, right? it currently does not have that option, but it also would not make much sense.

@sagikazarmark
Copy link
Member

Agreed. Actually there are several previous exceptions which are exposed through a custom API.

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class TransferExceptionSpec extends ObjectBehavior
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or is there a way to spec these things without instantiating the class?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a stub, like in case of BatchRequest trait and test that.

@dbu
Copy link
Contributor Author

dbu commented Oct 23, 2015

this looks ready from my point, please merge if you agree. i added php-http/utils#12 to adjust the BatchResult implementation.

@sagikazarmark
Copy link
Member

Do you want to add tests for TransferException prior to merging?

@dbu
Copy link
Contributor Author

dbu commented Oct 23, 2015

added the TransferExcpetion spec back. ready to merge i hope?

@sagikazarmark
Copy link
Member

Go ahead once tests are finished.

dbu added a commit that referenced this pull request Oct 23, 2015
cleanup phpdoc and BatchResult interface
@dbu dbu merged commit 0d626da into master Oct 23, 2015
@dbu dbu deleted the phpdoc branch October 23, 2015 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants