Skip to content

Commit 1a14cbd

Browse files
committed
[skip ci] Add type hints to JsUtils methods
Updated method signatures in JsUtils classes to include explicit type hints for parameters and return types, improving code clarity and type safety.
1 parent 6f7cef5 commit 1a14cbd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Ajax/JsUtils.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function semantic(?Semantic $semantic = NULL) {
173173
* @param Config|null $config
174174
* @return Config
175175
*/
176-
public function config(Config $config = NULL) {
176+
public function config(?Config $config = NULL) {
177177
if ($config === NULL) {
178178
if ($this->config === NULL) {
179179
$this->config = new DefaultConfig();
@@ -392,7 +392,7 @@ public function scriptCount(): int {
392392
* If a CDATA section should be added
393393
* @return string
394394
*/
395-
public function inline($script, $cdata = TRUE) {
395+
public function inline(string $script, bool $cdata = TRUE): string {
396396
$str = $this->_open_script();
397397
$str .= ($cdata) ? "\n// <![CDATA[\n{$script}\n// ]]>\n" : "\n{$script}\n";
398398
$str .= $this->_close_script();
@@ -524,7 +524,7 @@ public function getInjected() {
524524
return $this->injected;
525525
}
526526

527-
public function setParam(string $param,$value){
527+
public function setParam(string $param,mixed $value): void {
528528
$this->params[$param]=$value;
529529
}
530530
}

Ajax/php/ubiquity/JsUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected function _open_script($src = '') {
2626
return $str;
2727
}
2828

29-
public function inline($script, $cdata = true) {
29+
public function inline(string $script, bool $cdata = true) {
3030
if (($this->params['csp'] ?? false) === 'hash' && ContentSecurityManager::isStarted()) {
3131
$script = ($cdata) ? "\n// <![CDATA[\n{$script}\n// ]]>\n" : "\n{$script}\n";
3232
ContentSecurityManager::getHash('jsUtils', $script);

0 commit comments

Comments
 (0)