Skip to content

Commit 42e5703

Browse files
committed
Fix build with PHP 5.6.
1 parent 47b36b9 commit 42e5703

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/main/php/Gomoob/Filter/Sql/SqlFilterConverter.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,8 @@ private function transformComplexFilter(
532532

533533
// If a logical expression is expressed
534534
if (count($tokens) === 3 &&
535-
($tokens[1]->getTokenCode() === LogicOperatorToken::AND ||
536-
$tokens[1]->getTokenCode() === LogicOperatorToken::OR)) {
535+
($tokens[1]->getTokenCode() === LogicOperatorToken::AND_OPERATOR ||
536+
$tokens[1]->getTokenCode() === LogicOperatorToken::OR_OPERATOR)) {
537537
// Transform the first part of the logical expression
538538
$sqlFilter1 = $this->transformSimpleFilter($key, $tokens[0]->getSequence(), $context);
539539

@@ -543,9 +543,9 @@ private function transformComplexFilter(
543543
// Creates the resulting SQL logical expression
544544
$result[0] = $sqlFilter1->getExpression();
545545

546-
if ($tokens[1]->getTokenCode() === LogicOperatorToken::AND) {
546+
if ($tokens[1]->getTokenCode() === LogicOperatorToken::AND_OPERATOR) {
547547
$result[0] .= ' AND ';
548-
} elseif ($tokens[1]->getTokenCode() === LogicOperatorToken::OR) {
548+
} elseif ($tokens[1]->getTokenCode() === LogicOperatorToken::OR_OPERATOR) {
549549
$result[0] .= ' OR ';
550550
}
551551

src/main/php/Gomoob/Filter/Tokenizer/LogicOperatorToken.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@
3434
*/
3535
class LogicOperatorToken extends Token
3636
{
37-
3837
/**
3938
* Token code associated to the '+' terminal.
4039
*/
41-
const AND = 1;
40+
const AND_OPERATOR = 1;
4241

4342
/**
4443
* Token code associated to an integer or float number terminal.
@@ -48,7 +47,7 @@ class LogicOperatorToken extends Token
4847
/**
4948
* Token code associated to the '-' terminal.
5049
*/
51-
const OR = 3;
50+
const OR_OPERATOR = 3;
5251

5352
/**
5453
* Token code associated to a string terminal.

src/main/php/Gomoob/Filter/Tokenizer/LogicOperatorTokenizer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public function __construct()
4747
// WARNING, ORDER IS VERY IMPORTANT
4848

4949
// Logic operator
50-
$this->addTokenInfo('(\+)', LogicOperatorToken::AND);
51-
$this->addTokenInfo('(-)', LogicOperatorToken::OR);
50+
$this->addTokenInfo('(\+)', LogicOperatorToken::AND_OPERATOR);
51+
$this->addTokenInfo('(-)', LogicOperatorToken::OR_OPERATOR);
5252

5353
// "Raw" values
5454
$this->addTokenInfo('([0-9.]+)', LogicOperatorToken::NUMBER);

0 commit comments

Comments
 (0)