diff options
author | Andreas Gohr <andi@splitbrain.org> | 2023-09-02 14:42:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-02 14:42:51 +0200 |
commit | 5ff5424d8c81c7123d8656a787af2ff85b3dec21 (patch) | |
tree | 322929ee01d892bb3c927e7fe1238369c647f820 /inc/Parsing/Lexer/ParallelRegex.php | |
parent | 0613df3287b82a98b1e97cf86ed9d4c8fbd16f1c (diff) | |
parent | 91560755291852b8302767d454183a7662666f7e (diff) | |
download | dokuwiki-5ff5424d8c81c7123d8656a787af2ff85b3dec21.tar.gz dokuwiki-5ff5424d8c81c7123d8656a787af2ff85b3dec21.zip |
Merge pull request #4045 from dokuwiki/autofix
Use Rector to autofix code smell
Diffstat (limited to 'inc/Parsing/Lexer/ParallelRegex.php')
-rw-r--r-- | inc/Parsing/Lexer/ParallelRegex.php | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/inc/Parsing/Lexer/ParallelRegex.php b/inc/Parsing/Lexer/ParallelRegex.php index bf1979950..d23fb332b 100644 --- a/inc/Parsing/Lexer/ParallelRegex.php +++ b/inc/Parsing/Lexer/ParallelRegex.php @@ -1,4 +1,5 @@ <?php + /** * Lexer adapted from Simple Test: http://sourceforge.net/projects/simpletest/ * For an intro to the Lexer see: @@ -17,9 +18,9 @@ namespace dokuwiki\Parsing\Lexer; class ParallelRegex { /** @var string[] patterns to match */ - protected $patterns; + protected $patterns = []; /** @var string[] labels for above patterns */ - protected $labels; + protected $labels = []; /** @var string the compound regex matching all patterns */ protected $regex; /** @var bool case sensitive matching? */ @@ -34,9 +35,6 @@ class ParallelRegex public function __construct($case) { $this->case = $case; - $this->patterns = array(); - $this->labels = array(); - $this->regex = null; } /** @@ -121,15 +119,15 @@ class ParallelRegex } } - $split = array($subject, "", ""); + $split = [$subject, "", ""]; return false; } - $idx = count($matches)-2; - list($pre, $post) = preg_split($this->patterns[$idx].$this->getPerlMatchingFlags(), $subject, 2); - $split = array($pre, $matches[0], $post); + $idx = count($matches) - 2; + [$pre, $post] = preg_split($this->patterns[$idx] . $this->getPerlMatchingFlags(), $subject, 2); + $split = [$pre, $matches[0], $post]; - return isset($this->labels[$idx]) ? $this->labels[$idx] : true; + return $this->labels[$idx] ?? true; } /** |