We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d1d4bc8 commit adb716dCopy full SHA for adb716d
src/Symfony/Component/ExpressionLanguage/CHANGELOG.md
@@ -1,11 +1,6 @@
1
CHANGELOG
2
=========
3
4
-4.4.0
5
------
6
-
7
- * add `xor` operator
8
9
4.0.0
10
-----
11
src/Symfony/Component/ExpressionLanguage/Lexer.php
@@ -73,7 +73,7 @@ public function tokenize($expression)
73
// strings
74
$tokens[] = new Token(Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1)), $cursor + 1);
75
$cursor += \strlen($match[0]);
76
- } elseif (preg_match('/not in(?=[\s(])|\!\=\=|not(?=[\s(])|and(?=[\s(])|\=\=\=|\>\=|or(?=[\s(])|xor(?=[\s(])|\<\=|\*\*|\.\.|in(?=[\s(])|&&|\|\||matches|\=\=|\!\=|\*|~|%|\/|\>|\||\!|\^|&|\+|\<|\-/A', $expression, $match, 0, $cursor)) {
+ } elseif (preg_match('/not in(?=[\s(])|\!\=\=|not(?=[\s(])|and(?=[\s(])|\=\=\=|\>\=|or(?=[\s(])|\<\=|\*\*|\.\.|in(?=[\s(])|&&|\|\||matches|\=\=|\!\=|\*|~|%|\/|\>|\||\!|\^|&|\+|\<|\-/A', $expression, $match, 0, $cursor)) {
77
// operators
78
$tokens[] = new Token(Token::OPERATOR_TYPE, $match[0], $cursor + 1);
79
src/Symfony/Component/ExpressionLanguage/Node/BinaryNode.php
@@ -104,8 +104,6 @@ public function evaluate($functions, $values)
104
case 'or':
105
case '||':
106
return $left || $this->nodes['right']->evaluate($functions, $values);
107
- case 'xor':
108
- return $left xor $this->nodes['right']->evaluate($functions, $values);
109
case 'and':
110
case '&&':
111
return $left && $this->nodes['right']->evaluate($functions, $values);
src/Symfony/Component/ExpressionLanguage/Parser.php
@@ -45,7 +45,6 @@ public function __construct(array $functions)
45
$this->binaryOperators = [
46
'or' => ['precedence' => 10, 'associativity' => self::OPERATOR_LEFT],
47
'||' => ['precedence' => 10, 'associativity' => self::OPERATOR_LEFT],
48
- 'xor' => ['precedence' => 13, 'associativity' => self::OPERATOR_LEFT],
49
'and' => ['precedence' => 15, 'associativity' => self::OPERATOR_LEFT],
50
'&&' => ['precedence' => 15, 'associativity' => self::OPERATOR_LEFT],
51
'|' => ['precedence' => 16, 'associativity' => self::OPERATOR_LEFT],
src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
@@ -256,35 +256,4 @@ function (ExpressionLanguage $el) {
256
],
257
];
258
}
259
260
- /**
261
- * @dataProvider getLogicalOperators
262
- */
263
- public function testLogicalOperators($expression, $expected)
264
- {
265
- $this->assertSame($expected, (new ExpressionLanguage())->evaluate($expression));
266
- }
267
268
- public function getLogicalOperators()
269
270
- return [
271
- // AND
272
- ['true and true', true],
273
- ['true and false', false],
274
- ['false and true', false],
275
- ['false and false', false],
276
277
- // OR
278
- ['true or true', true],
279
- ['true or false', true],
280
- ['false or true', true],
281
- ['false or false', false],
282
283
- // XOR
284
- ['true xor true', false],
285
- ['true xor false', true],
286
- ['false xor true', true],
287
- ['false xor false', false],
288
- ];
289
290
src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
@@ -114,14 +114,6 @@ public function getTokenizeData()
114
[new Token('string', '#foo', 1)],
115
'"#foo"',
116
117
- [
118
119
- new Token('name', 'a', 1),
120
- new Token('operator', 'xor', 3),
121
- new Token('name', 'b', 7),
122
- ],
123
- 'a xor b',
124
125
126
127
src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
@@ -151,11 +151,6 @@ public function getParseData()
151
'bar',
152
['foo' => 'bar'],
153
154
155
156
- new Node\BinaryNode('xor', new Node\ConstantNode(true), new Node\ConstantNode(false)),
157
- 'true xor false',
158
159
160
161
0 commit comments