Skip to content

Commit 66e8566

Browse files
committed
Changed private static array-properties to const
1 parent c437826 commit 66e8566

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Node/BinaryNode.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
*/
2121
class 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
}

Node/UnaryNode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class UnaryNode extends Node
2222
{
23-
private static $operators = [
23+
private const OPERATORS = [
2424
'!' => '!',
2525
'not' => '!',
2626
'+' => '+',
@@ -39,7 +39,7 @@ public function compile(Compiler $compiler)
3939
{
4040
$compiler
4141
->raw('(')
42-
->raw(self::$operators[$this->attributes['operator']])
42+
->raw(self::OPERATORS[$this->attributes['operator']])
4343
->compile($this->nodes['node'])
4444
->raw(')')
4545
;

0 commit comments

Comments
 (0)