@@ -76,9 +76,7 @@ public function fromGlobals(): Request
7676 $ this ->getMethod (),
7777 $ remoteAddr ,
7878 $ remoteHost ,
79- function (): string {
80- return file_get_contents ('php://input ' );
81- }
79+ fn (): string => file_get_contents ('php://input ' ),
8280 );
8381 }
8482
@@ -271,9 +269,7 @@ private function getClient(Url $url): array
271269 : null ;
272270
273271 // use real client address and host if trusted proxy is used
274- $ usingTrustedProxy = $ remoteAddr && array_filter ($ this ->proxies , function (string $ proxy ) use ($ remoteAddr ): bool {
275- return Helpers::ipMatch ($ remoteAddr , $ proxy );
276- });
272+ $ usingTrustedProxy = $ remoteAddr && array_filter ($ this ->proxies , fn (string $ proxy ): bool => Helpers::ipMatch ($ remoteAddr , $ proxy ));
277273 if ($ usingTrustedProxy ) {
278274 empty ($ _SERVER ['HTTP_FORWARDED ' ])
279275 ? $ this ->useNonstandardProxy ($ url , $ remoteAddr , $ remoteHost )
@@ -339,11 +335,13 @@ private function useNonstandardProxy(Url $url, &$remoteAddr, &$remoteHost): void
339335 }
340336
341337 if (!empty ($ _SERVER ['HTTP_X_FORWARDED_FOR ' ])) {
342- $ xForwardedForWithoutProxies = array_filter (explode (', ' , $ _SERVER ['HTTP_X_FORWARDED_FOR ' ]), function (string $ ip ): bool {
343- return !array_filter ($ this ->proxies , function (string $ proxy ) use ($ ip ): bool {
344- return filter_var (trim ($ ip ), FILTER_VALIDATE_IP ) !== false && Helpers::ipMatch (trim ($ ip ), $ proxy );
345- });
346- });
338+ $ xForwardedForWithoutProxies = array_filter (
339+ explode (', ' , $ _SERVER ['HTTP_X_FORWARDED_FOR ' ]),
340+ fn (string $ ip ): bool => !array_filter (
341+ $ this ->proxies ,
342+ fn (string $ proxy ): bool => filter_var (trim ($ ip ), FILTER_VALIDATE_IP ) !== false && Helpers::ipMatch (trim ($ ip ), $ proxy ),
343+ ),
344+ );
347345 if ($ xForwardedForWithoutProxies ) {
348346 $ remoteAddr = trim (end ($ xForwardedForWithoutProxies ));
349347 $ xForwardedForRealIpKey = key ($ xForwardedForWithoutProxies );
0 commit comments