Skip to content

Commit c18b0c3

Browse files
committedJun 21, 2018
chore(support): we still have php5 here :)
1 parent 1b532e1 commit c18b0c3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎src/Comment.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ public function strip($json)
3131
list($index, $return, $char) = [-1, '', ''];
3232

3333
while (isset($json[++$index])) {
34-
list($prev, $char, $charnext) = [$char, $json[$index], $json[$index] . ($json[$index + 1] ?? '')];
34+
list($prev, $char) = [$char, $json[$index]];
3535

36+
$charnext = $char . (isset($json[$index + 1]) ? $json[$index + 1] : '');
3637
if ($this->inStringOrCommentEnd($prev, $char, $charnext)) {
3738
$return .= $char;
3839

@@ -50,7 +51,7 @@ public function strip($json)
5051
return $return;
5152
}
5253

53-
protected function inStringOrCommentEnd(string $prev, string $char, string $charnext): bool
54+
protected function inStringOrCommentEnd($prev, $char, $charnext)
5455
{
5556
if (0 === $this->comment && $char === '"' && $prev !== '\\') {
5657
$this->inStr = !$this->inStr;
@@ -63,7 +64,7 @@ protected function inStringOrCommentEnd(string $prev, string $char, string $char
6364
return $this->inStr || 0 === $this->comment;
6465
}
6566

66-
protected function hasCommentEnded(string $char, string $charnext): bool
67+
protected function hasCommentEnded($char, $charnext)
6768
{
6869
$singleEnded = $this->comment === 1 && $char == "\n";
6970
$multiEnded = $this->comment === 2 && $charnext == '*/';

0 commit comments

Comments
 (0)
Please sign in to comment.