Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f828aee

Browse filesBrowse files
committed
Merge branch '2.4'
* 2.4: fixed various inconsistencies reduced recursion when building DumperPrefixCollection renamed variables - making next change more readable removing dead code. [ExpressionLanguage] added some tests for the built-in constant() function [ExpressionLanguage] added some documentation about functions [DomCrawler] Fixed filterXPath() chaining [DomCrawler] Fixed incorrect handling of image inputs
2 parents d0386e4 + e2ac5df commit f828aee
Copy full SHA for f828aee

File tree

Expand file treeCollapse file tree

55 files changed

+147
-131
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

55 files changed

+147
-131
lines changed

‎src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public function refreshUser(UserInterface $user)
9292
);
9393
}
9494

95-
if (null === $refreshedUser = $this->repository->find($id)) {
95+
$refreshedUser = $this->repository->find($id);
96+
if (null === $refreshedUser) {
9697
throw new UsernameNotFoundException(sprintf('User with id %s not found', json_encode($id)));
9798
}
9899
}

‎src/Symfony/Bridge/Doctrine/Tests/Fixtures/AssociationEntity.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Fixtures/AssociationEntity.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
1313

14-
use Doctrine\ORM\Mapping AS ORM;
14+
use Doctrine\ORM\Mapping as ORM;
1515

1616
/**
1717
* @ORM\Entity

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function process(ContainerBuilder $container)
2222
{
2323
$filesystem = new Filesystem();
2424
$filesystem->dumpFile(
25-
$this->getCompilerLogFilename($container),
25+
self::getCompilerLogFilename($container),
2626
implode("\n", $container->getCompiler()->getLog()),
2727
0666 & ~umask()
2828
);

‎src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testFindAllTemplates()
3737
->will($this->returnValue(array('BaseBundle' => new BaseBundle())))
3838
;
3939

40-
$parser = new TemplateFilenameParser($kernel);
40+
$parser = new TemplateFilenameParser();
4141

4242
$finder = new TemplateFinder($kernel, $parser, __DIR__.'/../Fixtures/Resources');
4343

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testDefaultConfig()
3333
public function testValidTrustedProxies($trustedProxies, $processedProxies)
3434
{
3535
$processor = new Processor();
36-
$configuration = new Configuration(array());
36+
$configuration = new Configuration();
3737
$config = $processor->processConfiguration($configuration, array(array(
3838
'secret' => 's3cr3t',
3939
'trusted_proxies' => $trustedProxies
@@ -62,7 +62,7 @@ public function getTestValidTrustedProxiesData()
6262
public function testInvalidTypeTrustedProxies()
6363
{
6464
$processor = new Processor();
65-
$configuration = new Configuration(array());
65+
$configuration = new Configuration();
6666
$processor->processConfiguration($configuration, array(
6767
array(
6868
'secret' => 's3cr3t',
@@ -77,7 +77,7 @@ public function testInvalidTypeTrustedProxies()
7777
public function testInvalidValueTrustedProxies()
7878
{
7979
$processor = new Processor();
80-
$configuration = new Configuration(array());
80+
$configuration = new Configuration();
8181
$processor->processConfiguration($configuration, array(
8282
array(
8383
'secret' => 's3cr3t',

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected static function getKernelClass()
3737
{
3838
require_once __DIR__.'/app/AppKernel.php';
3939

40-
return 'Symfony\Bundle\FrameworkBundle\Tests\Functional\AppKernel';
40+
return 'Symfony\Bundle\FrameworkBundle\Tests\Functional\app\AppKernel';
4141
}
4242

4343
protected static function createKernel(array $options = array())

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
12+
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\app;
1313

1414
// get the autoload file
1515
$dir = __DIR__;

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected static function getKernelClass()
3737
{
3838
require_once __DIR__.'/app/AppKernel.php';
3939

40-
return 'Symfony\Bundle\SecurityBundle\Tests\Functional\AppKernel';
40+
return 'Symfony\Bundle\SecurityBundle\Tests\Functional\app\AppKernel';
4141
}
4242

4343
protected static function createKernel(array $options = array())

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
12+
namespace Symfony\Bundle\SecurityBundle\Tests\Functional\app;
1313

1414
// get the autoload file
1515
$dir = __DIR__;

‎src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
2222
public function testConfigTree($options, $results)
2323
{
2424
$processor = new Processor();
25-
$configuration = new Configuration(array());
25+
$configuration = new Configuration();
2626
$config = $processor->processConfiguration($configuration, array($options));
2727

2828
$this->assertEquals($results, $config);

‎src/Symfony/Component/ClassLoader/XcacheClassLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/XcacheClassLoader.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ public function findFile($class)
116116
if (xcache_isset($this->prefix.$class)) {
117117
$file = xcache_get($this->prefix.$class);
118118
} else {
119-
xcache_set($this->prefix.$class, $file = $this->classFinder->findFile($class));
119+
$file = $this->classFinder->findFile($class);
120+
xcache_set($this->prefix.$class, $file);
120121
}
121122

122123
return $file;

‎src/Symfony/Component/Console/Helper/ProgressHelper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Helper/ProgressHelper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ private function generate($finish = false)
352352
$vars = array();
353353
$percent = 0;
354354
if ($this->max > 0) {
355-
$percent = (double) $this->current / $this->max;
355+
$percent = (float) $this->current / $this->max;
356356
}
357357

358358
if (isset($this->formatVars['bar'])) {

‎src/Symfony/Component/Console/Tests/ApplicationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/ApplicationTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ public function testSetCatchExceptions()
471471
public function testAsText()
472472
{
473473
$application = new Application();
474-
$application->add(new \FooCommand);
474+
$application->add(new \FooCommand());
475475
$this->ensureStaticCommandHelp($application);
476476
$this->assertStringEqualsFile(self::$fixturesPath.'/application_astext1.txt', $this->normalizeLineBreaks($application->asText()), '->asText() returns a text representation of the application');
477477
$this->assertStringEqualsFile(self::$fixturesPath.'/application_astext2.txt', $this->normalizeLineBreaks($application->asText('foo')), '->asText() returns a text representation of the application');
@@ -480,7 +480,7 @@ public function testAsText()
480480
public function testAsXml()
481481
{
482482
$application = new Application();
483-
$application->add(new \FooCommand);
483+
$application->add(new \FooCommand());
484484
$this->ensureStaticCommandHelp($application);
485485
$this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application');
486486
$this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application');
@@ -504,7 +504,7 @@ public function testRenderException()
504504
$tester->run(array('command' => 'list', '--foo' => true), array('decorated' => false));
505505
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception2.txt', $tester->getDisplay(true), '->renderException() renders the command synopsis when an exception occurs in the context of a command');
506506

507-
$application->add(new \Foo3Command);
507+
$application->add(new \Foo3Command());
508508
$tester = new ApplicationTester($application);
509509
$tester->run(array('command' => 'foo3:bar'), array('decorated' => false));
510510
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions');

‎src/Symfony/Component/CssSelector/Tests/Parser/Handler/NumberHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/CssSelector/Tests/Parser/Handler/NumberHandlerTest.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Component\CssSelector\Parser\Handler\NumberHandler;
1515
use Symfony\Component\CssSelector\Parser\Token;
1616
use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
17-
use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping;
1817

1918
class NumberHandlerTest extends AbstractHandlerTest
2019
{
@@ -46,6 +45,6 @@ protected function generateHandler()
4645
{
4746
$patterns = new TokenizerPatterns();
4847

49-
return new NumberHandler($patterns, new TokenizerEscaping($patterns));
48+
return new NumberHandler($patterns);
5049
}
5150
}

‎src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ public function testHeaders()
5757
public function testNestedExceptions()
5858
{
5959
$handler = new ExceptionHandler(true);
60-
$response = $handler->createResponse(new \RuntimeException('Foo', null, new \RuntimeException('Bar')));
60+
$response = $handler->createResponse(new \RuntimeException('Foo', 0, new \RuntimeException('Bar')));
6161
}
6262
}

‎src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __construct(ContainerBuilder $container)
6969
{
7070
parent::__construct($container);
7171

72-
$this->inlinedDefinitions = new \SplObjectStorage;
72+
$this->inlinedDefinitions = new \SplObjectStorage();
7373
}
7474

7575
/**

‎src/Symfony/Component/DomCrawler/Crawler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Crawler.php
+6-8Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ public function parents()
454454
$nodes = array();
455455

456456
while ($node = $node->parentNode) {
457-
if (1 === $node->nodeType && '_root' !== $node->nodeName) {
457+
if (1 === $node->nodeType) {
458458
$nodes[] = $node;
459459
}
460460
}
@@ -599,16 +599,14 @@ public function extract($attributes)
599599
*/
600600
public function filterXPath($xpath)
601601
{
602-
$document = new \DOMDocument('1.0', 'UTF-8');
603-
$root = $document->appendChild($document->createElement('_root'));
602+
$crawler = new static(null, $this->uri);
603+
$prefixes = $this->findNamespacePrefixes($xpath);
604604
foreach ($this as $node) {
605-
$root->appendChild($document->importNode($node, true));
605+
$domxpath = $this->createDOMXPath($node->ownerDocument, $prefixes);
606+
$crawler->add($domxpath->query($xpath, $node));
606607
}
607608

608-
$prefixes = $this->findNamespacePrefixes($xpath);
609-
$domxpath = $this->createDOMXPath($document, $prefixes);
610-
611-
return new static($domxpath->query($xpath), $this->uri);
609+
return $crawler;
612610
}
613611

614612
/**

‎src/Symfony/Component/DomCrawler/Field/FormField.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Field/FormField.php
+1-7Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,7 @@ public function __construct(\DOMNode $node)
5252
{
5353
$this->node = $node;
5454
$this->name = $node->getAttribute('name');
55-
56-
$this->document = new \DOMDocument('1.0', 'UTF-8');
57-
$this->node = $this->document->importNode($this->node, true);
58-
59-
$root = $this->document->appendChild($this->document->createElement('_root'));
60-
$root->appendChild($this->node);
61-
$this->xpath = new \DOMXPath($this->document);
55+
$this->xpath = new \DOMXPath($node->ownerDocument);
6256

6357
$this->initialize();
6458
}

‎src/Symfony/Component/DomCrawler/Form.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Form.php
+24-15Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -394,34 +394,43 @@ private function initialize()
394394
{
395395
$this->fields = new FormFieldRegistry();
396396

397-
$document = new \DOMDocument('1.0', 'UTF-8');
398-
$xpath = new \DOMXPath($document);
399-
$root = $document->appendChild($document->createElement('_root'));
397+
$xpath = new \DOMXPath($this->node->ownerDocument);
400398

401399
// add submitted button if it has a valid name
402400
if ('form' !== $this->button->nodeName && $this->button->hasAttribute('name') && $this->button->getAttribute('name')) {
403-
$this->set(new Field\InputFormField($document->importNode($this->button, true)));
401+
if ('input' == $this->button->nodeName && 'image' == $this->button->getAttribute('type')) {
402+
$name = $this->button->getAttribute('name');
403+
$this->button->setAttribute('value', '0');
404+
405+
// temporarily change the name of the input node for the x coordinate
406+
$this->button->setAttribute('name', $name.'.x');
407+
$this->set(new Field\InputFormField($this->button));
408+
409+
// temporarily change the name of the input node for the y coordinate
410+
$this->button->setAttribute('name', $name.'.y');
411+
$this->set(new Field\InputFormField($this->button));
412+
413+
// restore the original name of the input node
414+
$this->button->setAttribute('name', $name);
415+
} else {
416+
$this->set(new Field\InputFormField($this->button));
417+
}
404418
}
405419

406420
// find form elements corresponding to the current form
407421
if ($this->node->hasAttribute('id')) {
408-
// traverse through the whole document
409-
$node = $document->importNode($this->node->ownerDocument->documentElement, true);
410-
$root->appendChild($node);
411-
412422
// corresponding elements are either descendants or have a matching HTML5 form attribute
413423
$formId = Crawler::xpathLiteral($this->node->getAttribute('id'));
414-
$fieldNodes = $xpath->query(sprintf('descendant::input[@form=%s] | descendant::button[@form=%s] | descendant::textarea[@form=%s] | descendant::select[@form=%s] | //form[@id=%s]//input[not(@form)] | //form[@id=%s]//button[not(@form)] | //form[@id=%s]//textarea[not(@form)] | //form[@id=%s]//select[not(@form)]', $formId, $formId, $formId, $formId, $formId, $formId, $formId, $formId), $root);
424+
425+
// do the xpath query without $this->node as the context node (i.e. traverse through the whole document)
426+
$fieldNodes = $xpath->query(sprintf('descendant::input[@form=%s] | descendant::button[@form=%s] | descendant::textarea[@form=%s] | descendant::select[@form=%s] | //form[@id=%s]//input[not(@form)] | //form[@id=%s]//button[not(@form)] | //form[@id=%s]//textarea[not(@form)] | //form[@id=%s]//select[not(@form)]', $formId, $formId, $formId, $formId, $formId, $formId, $formId, $formId));
415427
foreach ($fieldNodes as $node) {
416428
$this->addField($node);
417429
}
418430
} else {
419-
// parent form has no id, add descendant elements only
420-
$node = $document->importNode($this->node, true);
421-
$root->appendChild($node);
422-
423-
// descendant elements with form attribute are not part of this form
424-
$fieldNodes = $xpath->query('descendant::input[not(@form)] | descendant::button[not(@form)] | descendant::textarea[not(@form)] | descendant::select[not(@form)]', $root);
431+
// do the xpath query with $this->node as the context node, to only find descendant elements
432+
// however, descendant elements with form attribute are not part of this form
433+
$fieldNodes = $xpath->query('descendant::input[not(@form)] | descendant::button[not(@form)] | descendant::textarea[not(@form)] | descendant::select[not(@form)]', $this->node);
425434
foreach ($fieldNodes as $node) {
426435
$this->addField($node);
427436
}

‎src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,10 @@ public function testFilterXPath()
390390
$this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->filterXPath() returns a new instance of a crawler');
391391

392392
$crawler = $this->createTestCrawler()->filterXPath('//ul');
393-
394393
$this->assertCount(6, $crawler->filterXPath('//li'), '->filterXPath() filters the node list with the XPath expression');
394+
395+
$crawler = $this->createTestCrawler();
396+
$this->assertCount(3, $crawler->filterXPath('//body')->filterXPath('//button')->parents(), '->filterXpath() preserves parents when chained');
395397
}
396398

397399
public function testFilterXPathWithDefaultNamespace()

‎src/Symfony/Component/DomCrawler/Tests/FormTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Tests/FormTest.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ public function provideInitializeValues()
223223
<input type="submit" name="foobar" value="foobar" />',
224224
array('foobar' => array('InputFormField', 'foobar')),
225225
),
226+
array(
227+
'turns an image input into x and y fields',
228+
'<input type="image" name="bar" />',
229+
array('bar.x' => array('InputFormField', '0'), 'bar.y' => array('InputFormField', '0')),
230+
),
226231
array(
227232
'returns textareas',
228233
'<textarea name="foo">foo</textarea>

‎src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ public function testHasListenersOnLazyLoad()
175175

176176
public function testGetListenersOnLazyLoad()
177177
{
178-
$event = new Event();
179-
180178
$service = $this->getMock('Symfony\Component\EventDispatcher\Tests\Service');
181179

182180
$container = new Container();
@@ -194,8 +192,6 @@ public function testGetListenersOnLazyLoad()
194192

195193
public function testRemoveAfterDispatch()
196194
{
197-
$event = new Event();
198-
199195
$service = $this->getMock('Symfony\Component\EventDispatcher\Tests\Service');
200196

201197
$container = new Container();
@@ -211,8 +207,6 @@ public function testRemoveAfterDispatch()
211207

212208
public function testRemoveBeforeDispatch()
213209
{
214-
$event = new Event();
215-
216210
$service = $this->getMock('Symfony\Component\EventDispatcher\Tests\Service');
217211

218212
$container = new Container();

‎src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ public function testRemoveSubscriberWithMultipleListeners()
240240

241241
public function testEventReceivesTheDispatcherInstance()
242242
{
243+
$dispatcher = null;
243244
$this->dispatcher->addListener('test', function ($event) use (&$dispatcher) {
244245
$dispatcher = $event->getDispatcher();
245246
});

‎src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\EventDispatcher\Event;
1515
use Symfony\Component\EventDispatcher\ImmutableEventDispatcher;
16-
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1716

1817
/**
1918
* @author Bernhard Schussek <bschussek@gmail.com>

‎src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ public function parse($expression, $names)
9292
/**
9393
* Registers a function.
9494
*
95+
* A function is defined by two PHP callables. The callables are used
96+
* by the language to compile and/or evaluate the function.
97+
*
98+
* The first function is used at compilation time and must return a
99+
* PHP representation of the function call (it receives the function
100+
* arguments as arguments).
101+
*
102+
* The second function is used for expression evaluation and must return
103+
* the value of the function call based on the values defined for the
104+
* expression (it receives the values as a first argument and the function
105+
* arguments as remaining arguments).
106+
*
95107
* @param string $name The function name
96108
* @param callable $compiler A callable able to compile the function
97109
* @param callable $evaluator A callable able to evaluate the function

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,13 @@ public function testCachedParse()
4545
$parsedExpression = $expressionLanguage->parse('1 + 1', array());
4646
$this->assertSame($savedParsedExpression, $parsedExpression);
4747
}
48+
49+
public function testConstantFunction()
50+
{
51+
$expressionLanguage = new ExpressionLanguage();
52+
$this->assertEquals(PHP_VERSION, $expressionLanguage->evaluate('constant("PHP_VERSION")'));
53+
54+
$expressionLanguage = new ExpressionLanguage();
55+
$this->assertEquals('constant("PHP_VERSION")', $expressionLanguage->compile('constant("PHP_VERSION")'));
56+
}
4857
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.