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
-------

18f0fc594d [ExpressionLanguage] Fix PhpDoc type-hints on Token value
This commit is contained in:
Fabien Potencier 2017-11-12 07:39:34 -08:00
commit cf78277f93
2 changed files with 11 additions and 3 deletions

View File

@ -116,6 +116,14 @@ class ExpressionLanguageTest extends TestCase
$this->assertSame('($a + $B)', $result);
}
public function testStrictEquality()
{
$expressionLanguage = new ExpressionLanguage();
$expression = '123 === a';
$result = $expressionLanguage->compile($expression, array('a'));
$this->assertSame('(123 === $a)', $result);
}
public function testCachingWithDifferentNamesOrder()
{
$cacheMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();

View File

@ -30,9 +30,9 @@ class Token
const PUNCTUATION_TYPE = 'punctuation';
/**
* @param string $type The type of the token (self::*_TYPE)
* @param string $value The token value
* @param int $cursor The cursor position in the source
* @param string $type The type of the token (self::*_TYPE)
* @param string|int|float|null $value The token value
* @param int $cursor The cursor position in the source
*/
public function __construct($type, $value, $cursor)
{