@@ -50,11 +50,10 @@ class CspHeaderMiddleware implements MiddlewareInterface
5050 */
5151 protected array $ policies ;
5252
53- // TODO: rename to throw-on-configuration-error in next major version
5453 /**
55- * @Flow\InjectConfiguration(path="throw-invalid-directive-exception ")
54+ * @Flow\InjectConfiguration(path="throw-exception-on-configuration-error ")
5655 */
57- protected bool $ throwInvalidDirectiveException ;
56+ protected bool $ throwExceptionOnConfigurationError ;
5857
5958 /**
6059 * @Flow\Inject
@@ -69,7 +68,7 @@ class CspHeaderMiddleware implements MiddlewareInterface
6968 public function process (ServerRequestInterface $ request , RequestHandlerInterface $ handler ): ResponseInterface
7069 {
7170 $ response = $ handler ->handle ($ request );
72- if (! $ this ->enabled ) {
71+ if (!$ this ->enabled ) {
7372 return $ response ;
7473 }
7574
@@ -102,7 +101,7 @@ private function getPolicyByCurrentContext(ServerRequestInterface $request): Pol
102101 $ result = preg_match ('# ' . str_replace ('# ' , '\# ' , $ pattern ) . '# ' , $ path );
103102 if ($ result === false ) {
104103 $ message = sprintf ('Invalid matchUri pattern "%s": %s ' , $ pattern , preg_last_error_msg ());
105- if ($ this ->throwInvalidDirectiveException ) {
104+ if ($ this ->throwExceptionOnConfigurationError ) {
106105 throw new InvalidArgumentException ($ message );
107106 }
108107 $ this ->logger ->critical ($ message );
@@ -141,14 +140,14 @@ private function addNonceToTags(string $markup): string
141140 }
142141
143142 /**
144- * @param string[] $tagNames
143+ * @param string[] $tagNames
145144 */
146145 private function checkTagAndReplaceUsingACallback (
147146 array $ tagNames ,
148147 string $ contentMarkup ,
149148 callable $ hitCallback
150149 ): string {
151- $ regex = '/<( ' . implode ('| ' , $ tagNames ). ').*?>/ ' ;
150+ $ regex = '/<( ' . implode ('| ' , $ tagNames ) . ').*?>/ ' ;
152151
153152 return preg_replace_callback (
154153 $ regex ,
0 commit comments