Skip to content

Commit

Permalink
Fix warning on access array offset on value of type null
Browse files Browse the repository at this point in the history
when $param is 'linenums', preg_match call returns only `$m[0]`, no `$m[1]`, `$m[2]` are avaialble.
  • Loading branch information
ssahara committed Sep 16, 2023
1 parent 51f1d45 commit ae8e2c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion syntax/code.php
Expand Up @@ -142,7 +142,7 @@ private function getPrettifierOptions($params)
$offset = 1;
if (preg_match('/\b(no)?linenums(:\d+)?/', $params, $m, PREG_OFFSET_CAPTURE)) {
$offset = ($offset > 0) ? $m[0][1] : 1;
$opts['linenums'] = $m[1][0] ? '' : $m[0][0];
$opts['linenums'] = ('no' == $m[1][0] ?? '') ? 'linenums:0' : $m[0][0];
} else {
$opts['linenums'] = $this->getConf('linenums') ? 'linenums' : '';
}
Expand Down

0 comments on commit ae8e2c4

Please sign in to comment.