Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf78277

Browse files
committed
minor #24884 [ExpressionLanguage] Fixed PhpDoc type-hints on Token value (mcg-web)
This PR was merged into the 2.7 branch. Discussion ---------- [ExpressionLanguage] Fixed PhpDoc type-hints on Token value | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | none | License | MIT | Doc PR | none Fixed PhpDoc type-hints on Token value and added test to prevent BC with Parser when treating numbers (example `a === 123` compile as `$a === "123"`) Commits ------- 18f0fc5 [ExpressionLanguage] Fix PhpDoc type-hints on Token value
2 parents 6fe8435 + 18f0fc5 commit cf78277

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ public function testCachingForOverriddenVariableNames()
116116
$this->assertSame('($a + $B)', $result);
117117
}
118118

119+
public function testStrictEquality()
120+
{
121+
$expressionLanguage = new ExpressionLanguage();
122+
$expression = '123 === a';
123+
$result = $expressionLanguage->compile($expression, array('a'));
124+
$this->assertSame('(123 === $a)', $result);
125+
}
126+
119127
public function testCachingWithDifferentNamesOrder()
120128
{
121129
$cacheMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();

src/Symfony/Component/ExpressionLanguage/Token.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class Token
3030
const PUNCTUATION_TYPE = 'punctuation';
3131

3232
/**
33-
* @param string $type The type of the token (self::*_TYPE)
34-
* @param string $value The token value
35-
* @param int $cursor The cursor position in the source
33+
* @param string $type The type of the token (self::*_TYPE)
34+
* @param string|int|float|null $value The token value
35+
* @param int $cursor The cursor position in the source
3636
*/
3737
public function __construct($type, $value, $cursor)
3838
{

0 commit comments

Comments
 (0)