@@ -166,43 +166,39 @@ protected function configureAndRegisterClient(): void
166
166
$ userIntegrations = $ this ->resolveIntegrationsFromUserConfig ();
167
167
168
168
$ options ->setIntegrations (function (array $ integrations ) use ($ options , $ userIntegrations ) {
169
- $ allIntegrations = array_merge ($ integrations , $ userIntegrations );
170
-
171
- if (!$ options ->hasDefaultIntegrations ()) {
172
- return $ allIntegrations ;
169
+ if ($ options ->hasDefaultIntegrations ()) {
170
+ // Remove the default error and fatal exception listeners to let Laravel handle those
171
+ // itself. These event are still bubbling up through the documented changes in the users
172
+ // `ExceptionHandler` of their application or through the log channel integration to Sentry
173
+ $ integrations = array_filter ($ integrations , static function (SdkIntegration \IntegrationInterface $ integration ): bool {
174
+ if ($ integration instanceof SdkIntegration \ErrorListenerIntegration) {
175
+ return false ;
176
+ }
177
+
178
+ if ($ integration instanceof SdkIntegration \ExceptionListenerIntegration) {
179
+ return false ;
180
+ }
181
+
182
+ if ($ integration instanceof SdkIntegration \FatalErrorListenerIntegration) {
183
+ return false ;
184
+ }
185
+
186
+ // We also remove the default request integration so it can be readded
187
+ // after with a Laravel specific request fetcher. This way we can resolve
188
+ // the request from Laravel instead of constructing it from the global state
189
+ if ($ integration instanceof SdkIntegration \RequestIntegration) {
190
+ return false ;
191
+ }
192
+
193
+ return true ;
194
+ });
195
+
196
+ $ integrations [] = new SdkIntegration \RequestIntegration (
197
+ new LaravelRequestFetcher ($ this ->app )
198
+ );
173
199
}
174
200
175
- // Remove the default error and fatal exception listeners to let Laravel handle those
176
- // itself. These event are still bubbling up through the documented changes in the users
177
- // `ExceptionHandler` of their application or through the log channel integration to Sentry
178
- $ allIntegrations = array_filter ($ allIntegrations , static function (SdkIntegration \IntegrationInterface $ integration ): bool {
179
- if ($ integration instanceof SdkIntegration \ErrorListenerIntegration) {
180
- return false ;
181
- }
182
-
183
- if ($ integration instanceof SdkIntegration \ExceptionListenerIntegration) {
184
- return false ;
185
- }
186
-
187
- if ($ integration instanceof SdkIntegration \FatalErrorListenerIntegration) {
188
- return false ;
189
- }
190
-
191
- // We also remove the default request integration so it can be readded
192
- // after with a Laravel specific request fetcher. This way we can resolve
193
- // the request from Laravel instead of constructing it from the global state
194
- if ($ integration instanceof SdkIntegration \RequestIntegration) {
195
- return false ;
196
- }
197
-
198
- return true ;
199
- });
200
-
201
- $ allIntegrations [] = new SdkIntegration \RequestIntegration (
202
- new LaravelRequestFetcher ($ this ->app )
203
- );
204
-
205
- return $ allIntegrations ;
201
+ return array_merge ($ integrations , $ userIntegrations );
206
202
});
207
203
208
204
$ hub = new Hub ($ clientBuilder ->getClient ());
0 commit comments