@@ -44,13 +44,13 @@ final class AuthorizationMiddleware implements MiddlewareInterface
4444 private $ scopeProvider ;
4545
4646 /**
47- * @param ProtectedResourceMetadata $metadata The protected resource metadata to serve
48- * @param AuthorizationTokenValidatorInterface $validator Token validator implementation
49- * @param ResponseFactoryInterface|null $responseFactory PSR-17 response factory (auto-discovered if null)
50- * @param StreamFactoryInterface|null $streamFactory PSR-17 stream factory (auto-discovered if null)
51- * @param list<string> $metadataPaths Paths where metadata should be served (e.g., ["/.well-known/oauth-protected-resource"])
52- * @param string|null $resourceMetadataUrl Explicit URL for the resource_metadata in WWW-Authenticate
53- * @param callable(ServerRequestInterface): list<string>|null $scopeProvider Optional callback to determine required scopes per request
47+ * @param ProtectedResourceMetadata $metadata The protected resource metadata to serve
48+ * @param AuthorizationTokenValidatorInterface $validator Token validator implementation
49+ * @param ResponseFactoryInterface|null $responseFactory PSR-17 response factory (auto-discovered if null)
50+ * @param StreamFactoryInterface|null $streamFactory PSR-17 stream factory (auto-discovered if null)
51+ * @param list<string> $metadataPaths Paths where metadata should be served (e.g., ["/.well-known/oauth-protected-resource"])
52+ * @param string|null $resourceMetadataUrl Explicit URL for the resource_metadata in WWW-Authenticate
53+ * @param callable(ServerRequestInterface): list<string>|null $scopeProvider Optional callback to determine required scopes per request
5454 */
5555 public function __construct (
5656 private ProtectedResourceMetadata $ metadata ,
@@ -109,7 +109,7 @@ private function isMetadataRequest(ServerRequestInterface $request): bool
109109 return false ;
110110 }
111111
112- return in_array ($ request ->getUri ()->getPath (), $ this ->metadataPaths , true );
112+ return \ in_array ($ request ->getUri ()->getPath (), $ this ->metadataPaths , true );
113113 }
114114
115115 private function buildErrorResponse (ServerRequestInterface $ request , AuthorizationResult $ result ): ResponseInterface
@@ -130,27 +130,27 @@ private function buildAuthenticateHeader(ServerRequestInterface $request, Author
130130
131131 $ resourceMetadataUrl = $ this ->resolveResourceMetadataUrl ($ request );
132132 if (null !== $ resourceMetadataUrl ) {
133- $ parts [] = 'resource_metadata=" ' . $ this ->escapeHeaderValue ($ resourceMetadataUrl ) . '" ' ;
133+ $ parts [] = 'resource_metadata=" ' . $ this ->escapeHeaderValue ($ resourceMetadataUrl ). '" ' ;
134134 }
135135
136136 $ scopes = $ this ->resolveScopes ($ request , $ result );
137137 if (null !== $ scopes ) {
138- $ parts [] = 'scope=" ' . $ this ->escapeHeaderValue (implode (' ' , $ scopes )) . '" ' ;
138+ $ parts [] = 'scope=" ' . $ this ->escapeHeaderValue (implode (' ' , $ scopes )). '" ' ;
139139 }
140140
141141 if (null !== $ result ->getError ()) {
142- $ parts [] = 'error=" ' . $ this ->escapeHeaderValue ($ result ->getError ()) . '" ' ;
142+ $ parts [] = 'error=" ' . $ this ->escapeHeaderValue ($ result ->getError ()). '" ' ;
143143 }
144144
145145 if (null !== $ result ->getErrorDescription ()) {
146- $ parts [] = 'error_description=" ' . $ this ->escapeHeaderValue ($ result ->getErrorDescription ()) . '" ' ;
146+ $ parts [] = 'error_description=" ' . $ this ->escapeHeaderValue ($ result ->getErrorDescription ()). '" ' ;
147147 }
148148
149149 if ([] === $ parts ) {
150150 return 'Bearer ' ;
151151 }
152152
153- return 'Bearer ' . implode (', ' , $ parts );
153+ return 'Bearer ' . implode (', ' , $ parts );
154154 }
155155
156156 /**
@@ -210,7 +210,7 @@ private function resolveResourceMetadataUrl(ServerRequestInterface $request): ?s
210210 return null ;
211211 }
212212
213- return $ scheme . ':// ' . $ authority . $ this ->metadataPaths [0 ];
213+ return $ scheme. ':// ' . $ authority. $ this ->metadataPaths [0 ];
214214 }
215215
216216 /**
@@ -240,7 +240,7 @@ private function normalizePaths(array $paths): array
240240 continue ;
241241 }
242242 if ('/ ' !== $ path [0 ]) {
243- $ path = '/ ' . $ path ;
243+ $ path = '/ ' . $ path ;
244244 }
245245 $ normalized [] = $ path ;
246246 }
0 commit comments