@@ -30,7 +30,7 @@ protected function redererChanges(array $changes): string
3030
3131 $ wrapperClasses = [
3232 ...$ this ->options ['wrapperClasses ' ],
33- ...[ 'diff ' , 'diff-html ' , 'diff-side-by-side ' ] ,
33+ 'diff ' , 'diff-html ' , 'diff-side-by-side ' ,
3434 ];
3535
3636 return
@@ -104,16 +104,19 @@ protected function renderTableHunks(array $hunks): string
104104 */
105105 protected function renderTableBlock (array $ block ): string
106106 {
107- static $ callbacks = [
108- SequenceMatcher::OP_EQ => 'renderTableBlockEqual ' ,
109- SequenceMatcher::OP_INS => 'renderTableBlockInsert ' ,
110- SequenceMatcher::OP_DEL => 'renderTableBlockDelete ' ,
111- SequenceMatcher::OP_REP => 'renderTableBlockReplace ' ,
107+ static $ callbacks ;
108+
109+ // @todo rewrite with "first-class callable" (PHP 8.1)
110+ $ callbacks ??= [
111+ SequenceMatcher::OP_EQ => [$ this , 'renderTableBlockEqual ' ],
112+ SequenceMatcher::OP_INS => [$ this , 'renderTableBlockInsert ' ],
113+ SequenceMatcher::OP_DEL => [$ this , 'renderTableBlockDelete ' ],
114+ SequenceMatcher::OP_REP => [$ this , 'renderTableBlockReplace ' ],
112115 ];
113116
114117 return
115118 '<tbody class="change change- ' . self ::TAG_CLASS_MAP [$ block ['tag ' ]] . '"> ' .
116- $ this ->{ $ callbacks [$ block ['tag ' ]]} ($ block ) .
119+ $ callbacks [$ block ['tag ' ]]($ block ) .
117120 '</tbody> ' ;
118121 }
119122
0 commit comments