2020 */
2121class BinaryNode extends Node
2222{
23- private static $ operators = [
23+ private const OPERATORS = [
2424 '~ ' => '. ' ,
2525 'and ' => '&& ' ,
2626 'or ' => '|| ' ,
2727 ];
2828
29- private static $ functions = [
29+ private const FUNCTIONS = [
3030 '** ' => 'pow ' ,
3131 '.. ' => 'range ' ,
3232 'in ' => 'in_array ' ,
@@ -57,9 +57,9 @@ public function compile(Compiler $compiler)
5757 return ;
5858 }
5959
60- if (isset (self ::$ functions [$ operator ])) {
60+ if (isset (self ::FUNCTIONS [$ operator ])) {
6161 $ compiler
62- ->raw (sprintf ('%s( ' , self ::$ functions [$ operator ]))
62+ ->raw (sprintf ('%s( ' , self ::FUNCTIONS [$ operator ]))
6363 ->compile ($ this ->nodes ['left ' ])
6464 ->raw (', ' )
6565 ->compile ($ this ->nodes ['right ' ])
@@ -69,8 +69,8 @@ public function compile(Compiler $compiler)
6969 return ;
7070 }
7171
72- if (isset (self ::$ operators [$ operator ])) {
73- $ operator = self ::$ operators [$ operator ];
72+ if (isset (self ::OPERATORS [$ operator ])) {
73+ $ operator = self ::OPERATORS [$ operator ];
7474 }
7575
7676 $ compiler
@@ -89,13 +89,13 @@ public function evaluate($functions, $values)
8989 $ operator = $ this ->attributes ['operator ' ];
9090 $ left = $ this ->nodes ['left ' ]->evaluate ($ functions , $ values );
9191
92- if (isset (self ::$ functions [$ operator ])) {
92+ if (isset (self ::FUNCTIONS [$ operator ])) {
9393 $ right = $ this ->nodes ['right ' ]->evaluate ($ functions , $ values );
9494
9595 if ('not in ' === $ operator ) {
9696 return !\in_array ($ left , $ right );
9797 }
98- $ f = self ::$ functions [$ operator ];
98+ $ f = self ::FUNCTIONS [$ operator ];
9999
100100 return $ f ($ left , $ right );
101101 }
0 commit comments