-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Update the PHP transport classes section #1276
Update the PHP transport classes section #1276
Conversation
The section regarding the |
@ste93cry thanks for catching that, I have updated the merge request. |
Version |
@ste93cry oof; you're right. I misread the version 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we released 2.3
this PR can be merged once reviewed. I've left a few comments, but overall it looks good
$transport = new NullTransport(); | ||
$builder = ClientBuilder::create(['dsn' => '___PUBLIC_DSN___']); | ||
$builder->setTransport($transport); | ||
$options = ['dsn' => '___PUBLIC_DSN___']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just inline this variable since we won't reuse it besides in the ClientBuilder::create
method
use Sentry\Transport\HttpTransport; | ||
use Sentry\State\Hub; | ||
use Sentry\Transport\TransportFactoryInterface; | ||
|
||
$options = ['dsn' => '___PUBLIC_DSN___']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just inline this variable since we won't reuse it besides in the ClientBuilder::create
method
'2.3' | ||
); | ||
|
||
$transportFactory = new class($httpClientFactory) implements TransportFactoryInterface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of creating a custom factory, the DefaultTransportFactory
can be used too in this case as the logic is basically the same. Of course if there was custom logic involved creating your own transport factory is still needed
$transportFactory = new class implements TransportFactoryInterface { | ||
public function create(\Sentry\Options $options): \Sentry\Transport\TransportInterface | ||
{ | ||
$spool = new MemorySpool(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the spool is the class that users should interact with to flush the events, it should be instantiated outside of the factory
@RageZBla Would you be so kind and do the last changes so we can merge this? |
Could you also update the interface where the deprecation comes from please? At the moment it is not possible to know what to do instead of calling |
Successor |
This should be merged when version 2.3 of the PHP SDK.
Related to getsentry/sentry-php#855 and getsentry/sentry-php#787