From d66de69ba57f00079ab8d5e4b9a1d1f73093e76a Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Tue, 28 Apr 2020 19:08:49 +0200 Subject: tests: phpstan adjustments + 3 phpstan fixes - force exclude templates and vendor directories @vincent-peugnet: this should stop the phpstan-vscode extension to report errors in templates. - fix errors that were only reported on github because of php 7.3: - Missing @throws JsonException annotation - Regex pattern is invalid: Compilation failed: invalid range in character class at offset 16 in pattern: %(src|href)="([\w-_]+(\/([\w-_])+)*\.[a-z0-9]{1,5})"% the regex expected a range beacause the `-` char was placed in between two others. + `\w` includes `_` - plus one last easy error: PHPDoc tag @param references unknown parameter: $authorcompare --- app/class/Modelrender.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/class/Modelrender.php') diff --git a/app/class/Modelrender.php b/app/class/Modelrender.php index 8f20f83..fa4a6a3 100644 --- a/app/class/Modelrender.php +++ b/app/class/Modelrender.php @@ -360,7 +360,7 @@ class Modelrender extends Modelpage public function media(string $text): string { - $regex = '%(src|href)="([\w-_]+(\/([\w-_])+)*\.[a-z0-9]{1,5})"%'; + $regex = '%(src|href)="([\w\-]+(\/([\w\-])+)*\.[a-z0-9]{1,5})"%'; $text = preg_replace($regex, '$1="' . Model::mediapath() . '$2" target="_blank" class="media"', $text); if (!is_string($text)) { //throw new Exception('Rendering error -> media module'); -- cgit v1.2.3