@@ -42,10 +42,10 @@ class ContentSecurityPolicy
4242 'object-src ' => 'objectSrc ' ,
4343 'plugin-types ' => 'pluginTypes ' ,
4444 'script-src ' => 'scriptSrc ' ,
45- 'script-src-elem ' => 'scriptSrcElem ' ,
4645 'style-src ' => 'styleSrc ' ,
47- 'manifest-src ' => 'manifestSrc ' ,
4846 'sandbox ' => 'sandbox ' ,
47+ 'manifest-src ' => 'manifestSrc ' ,
48+ 'script-src-elem ' => 'scriptSrcElem ' ,
4949 ];
5050
5151 /**
@@ -154,13 +154,6 @@ class ContentSecurityPolicy
154154 */
155155 protected $ scriptSrc = [];
156156
157- /**
158- * Used for security enforcement
159- *
160- * @var array|string
161- */
162- protected $ scriptSrcElem = [];
163-
164157 /**
165158 * The `style-src` directive restricts which styles the user may applies to the protected resource.
166159 *
@@ -193,6 +186,13 @@ class ContentSecurityPolicy
193186 */
194187 protected $ manifestSrc = [];
195188
189+ /**
190+ * The `script-src-elem` directive applies to all script requests and script blocks.
191+ *
192+ * @var array<string, bool>|string
193+ */
194+ protected $ scriptSrcElem = [];
195+
196196 /**
197197 * Instructs user agents to rewrite URL schemes by changing HTTP to HTTPS.
198198 *
@@ -658,12 +658,11 @@ public function addScriptSrc($uri, ?bool $explicitReporting = null)
658658 }
659659
660660 /**
661- * Adds a new valid endpoint for javascript file sources. Can be either
662- * a URI class or a simple string.
661+ * Adds a new value to the `script-src-elem` directive.
663662 *
664663 * @see https://www.w3.org/TR/CSP/#directive-script-src-elem
665664 *
666- * @param array |string $uri
665+ * @param list<string> |string $uri
667666 *
668667 * @return $this
669668 */
0 commit comments