fix: try to fix PHPStan errors, mostly: Cannot access offset '...' on mixed. And add missing types.
This commit is contained in:
parent
e76ab5f51d
commit
09c0d249d4
1 changed files with 6 additions and 6 deletions
|
|
@ -78,11 +78,11 @@ final class WordHighlighterExtension extends Minz_Extension
|
||||||
if (file_exists($configFileJson)) {
|
if (file_exists($configFileJson)) {
|
||||||
try {
|
try {
|
||||||
$confJson = json_decode(file_get_contents($configFileJson) ?: '', true, 8, JSON_THROW_ON_ERROR);
|
$confJson = json_decode(file_get_contents($configFileJson) ?: '', true, 8, JSON_THROW_ON_ERROR);
|
||||||
$this->enable_in_article = (bool) $confJson['enable_in_article'] ?: false;
|
$this->enable_in_article = (bool) ($confJson['enable_in_article'] ?? false);
|
||||||
$this->enable_logs = (bool) $confJson['enable_logs'] ?: false;
|
$this->enable_logs = (bool) ($confJson['enable_logs'] ?? false);
|
||||||
$this->case_sensitive = (bool) $confJson['case_sensitive'] ?: false;
|
$this->case_sensitive = (bool) ($confJson['case_sensitive'] ?? false);
|
||||||
$this->separate_word_search = (bool) $confJson['separate_word_search'] ?: false;
|
$this->separate_word_search = (bool) ($confJson['separate_word_search'] ?? false);
|
||||||
$this->word_highlighter_conf = implode("\n", (array) $confJson['words']);
|
$this->word_highlighter_conf = implode("\n", (array) ($confJson['words'] ?? []));
|
||||||
|
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
// probably nothing to do needed
|
// probably nothing to do needed
|
||||||
|
|
@ -90,7 +90,7 @@ final class WordHighlighterExtension extends Minz_Extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function jsonToJs($jsonStr)
|
private function jsonToJs(string $jsonStr): string
|
||||||
{
|
{
|
||||||
$js = "window.WordHighlighterConf = " .
|
$js = "window.WordHighlighterConf = " .
|
||||||
$jsonStr . ";\n" .
|
$jsonStr . ";\n" .
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue