Skip to content

TypeError: Argument 1 passed to ProfileClient::collectExceptionInformations() must be an instance of Exception #353

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 6 commits into from
Aug 1, 2019

Conversation

spolischook
Copy link
Contributor

@spolischook spolischook commented Jul 30, 2019

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
License MIT

What's in this PR?

Fix error

Why?

TypeError: Argument 1 passed to Http\HttplugBundle\Collector\ProfileClient::collectExceptionInformations() must be an instance of Exception, instance of TypeError given, called in /home/spolischook/www/mobile-api/vendor/php-http/httplug-bundle/src/Collector/ProfileClient.php on line 144

Checklist

  • Updated CHANGELOG.md to describe BC breaks / deprecations | new feature | bugfix
  • Documentation pull request created (if not simply a bugfix)

To Do

  • [] If the PR is not complete but you want to discuss the approach, list what remains to be done here

@spolischook spolischook changed the title Added test that reveal error TypeError: Argument 1 passed to ProfileClient::collectExceptionInformations() must be an instance of Exception Jul 30, 2019
@spolischook spolischook force-pushed the bug/catch_throwable_exceptions branch from 1274012 to 81c63ff Compare July 30, 2019 12:30
@spolischook
Copy link
Contributor Author

@Nyholm @fbourigault @dbu could you please approve/merge it?

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

I think this looks good.

*
* @return string
*/
public function formatException(Exception $exception)
public function formatException(\Throwable $exception)
Copy link
Member

Choose a reason for hiding this comment

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

This is not a BC break because the class is internal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

even more, Throwable is wide variation of Exception, so no BC break will happen

Copy link
Member

Choose a reason for hiding this comment

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

Yes. But that reason alone is still a BC break because the class is not final.

@Nyholm Nyholm merged commit 721e5e0 into php-http:master Aug 1, 2019
Copy link
Collaborator

@dbu dbu left a comment

Choose a reason for hiding this comment

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

thank you!

@@ -34,7 +35,7 @@ class ProfileClientTest extends TestCase
private $activeStack;

/**
* @var HttpClient
* @var HttpClient|MockObject
Copy link
Collaborator

Choose a reason for hiding this comment

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

right.

just a comment, no need to change anything now: i have seen the syntax HttpClient&MockObject which is semantically correct and needed from some phpstan level on so phpstan is sure about the type of the variable. however, e.g. phpstorm seems not to know about it...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, it's right, PhpStorm don't suggest any method of MockObject so I should to add this,

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.

4 participants