@@ -135,7 +135,7 @@ function printHelp(): void
135135
136136$ forwarder = new EnvelopeForwarder (
137137 $ upstreamTimeout ,
138- function (Psr \Http \Message \ResponseInterface $ response ) {
138+ static function (Psr \Http \Message \ResponseInterface $ response ) {
139139 if ($ response ->getStatusCode () >= 200 && $ response ->getStatusCode () < 300 ) {
140140 if ($ response ->getStatusCode () === 200 ) {
141141 $ responseBody = json_decode ($ response ->getBody ()->getContents (), true );
@@ -156,7 +156,7 @@ function (Psr\Http\Message\ResponseInterface $response) {
156156
157157 return null ;
158158 },
159- function (Throwable $ exception ) {
159+ static function (Throwable $ exception ) {
160160 Log::error ("Envelope send error: {$ exception ->getMessage ()}" );
161161
162162 return null ;
@@ -166,7 +166,7 @@ function (Throwable $exception) {
166166$ queue = new EnvelopeQueue (
167167 $ upstreamConcurrency ,
168168 $ queueLimit ,
169- function (Envelope $ envelope ) use ($ forwarder ) {
169+ static function (Envelope $ envelope ) use ($ forwarder ) {
170170 try {
171171 return $ forwarder ->forward ($ envelope );
172172 } catch (Exception $ e ) {
@@ -179,13 +179,13 @@ function (Envelope $envelope) use ($forwarder) {
179179
180180$ server = new Server (
181181 $ listenAddress ,
182- function (Throwable $ exception ) {
182+ static function (Throwable $ exception ) {
183183 Log::error ("Server error: {$ exception ->getMessage ()}" );
184184 },
185- function (Throwable $ exception ) {
185+ static function (Throwable $ exception ) {
186186 Log::error ("Incoming connection error: {$ exception ->getMessage ()}" );
187187 },
188- function (Envelope $ envelope ) use ($ queue ) {
188+ static function (Envelope $ envelope ) use ($ queue ) {
189189 Log::debug ('Envelope received, queueing forward to Sentry... ' );
190190
191191 $ queue ->enqueue ($ envelope );
@@ -219,7 +219,7 @@ function (Envelope $envelope) use ($queue) {
219219// Set up graceful shutdown handling
220220$ isShuttingDown = false ;
221221
222- $ shutdown = function (int $ signal ) use ($ server , $ controlServer , $ queue , $ drainTimeout , &$ isShuttingDown ) {
222+ $ shutdown = static function (int $ signal ) use ($ server , $ controlServer , $ queue , $ drainTimeout , &$ isShuttingDown ) {
223223 if ($ isShuttingDown ) {
224224 return ;
225225 }
@@ -238,7 +238,7 @@ function (Envelope $envelope) use ($queue) {
238238 $ checkInterval = 0.1 ;
239239 $ elapsed = 0.0 ;
240240
241- $ drain = function () use (&$ drain , $ queue , &$ elapsed , $ drainTimeout , $ checkInterval ) {
241+ $ drain = static function () use (&$ drain , $ queue , &$ elapsed , $ drainTimeout , $ checkInterval ) {
242242 $ remaining = count ($ queue );
243243
244244 if ($ remaining === 0 ) {
0 commit comments