Skip to content

Commit e1069b3

Browse files
committed
[ExpressionLanguage] remove deprecated features
1 parent 79bc327 commit e1069b3

File tree

6 files changed

+1
-399
lines changed

6 files changed

+1
-399
lines changed

src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
use Psr\Cache\CacheItemPoolInterface;
1515
use Symfony\Component\Cache\Adapter\ArrayAdapter;
16-
use Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter;
17-
use Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface;
1816

1917
/**
2018
* Allows to compile and evaluate expressions written in your own DSL.
@@ -37,17 +35,8 @@ class ExpressionLanguage
3735
* @param CacheItemPoolInterface $cache
3836
* @param ExpressionFunctionProviderInterface[] $providers
3937
*/
40-
public function __construct($cache = null, array $providers = array())
38+
public function __construct(CacheItemPoolInterface $cache = null, array $providers = array())
4139
{
42-
if (null !== $cache) {
43-
if ($cache instanceof ParserCacheInterface) {
44-
@trigger_error(sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of 3.2 and will be removed in 4.0. Pass an instance of %s instead.', ParserCacheInterface::class, self::class, CacheItemPoolInterface::class), E_USER_DEPRECATED);
45-
$cache = new ParserCacheAdapter($cache);
46-
} elseif (!$cache instanceof CacheItemPoolInterface) {
47-
throw new \InvalidArgumentException(sprintf('Cache argument has to implement %s.', CacheItemPoolInterface::class));
48-
}
49-
}
50-
5140
$this->cache = $cache ?: new ArrayAdapter();
5241
$this->registerFunctions();
5342
foreach ($providers as $provider) {

src/Symfony/Component/ExpressionLanguage/ParserCache/ArrayParserCache.php

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php

Lines changed: 0 additions & 120 deletions
This file was deleted.

src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheInterface.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

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

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -63,47 +63,6 @@ public function testCachedParse()
6363
$this->assertSame($savedParsedExpression, $parsedExpression);
6464
}
6565

66-
/**
67-
* @group legacy
68-
*/
69-
public function testCachedParseWithDeprecatedParserCacheInterface()
70-
{
71-
$cacheMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
72-
73-
$cacheItemMock = $this->getMockBuilder('Psr\Cache\CacheItemInterface')->getMock();
74-
$savedParsedExpression = null;
75-
$expressionLanguage = new ExpressionLanguage($cacheMock);
76-
77-
$cacheMock
78-
->expects($this->exactly(1))
79-
->method('fetch')
80-
->with('1%20%2B%201%2F%2F')
81-
->willReturn($savedParsedExpression)
82-
;
83-
84-
$cacheMock
85-
->expects($this->exactly(1))
86-
->method('save')
87-
->with('1%20%2B%201%2F%2F', $this->isInstanceOf(ParsedExpression::class))
88-
->will($this->returnCallback(function ($key, $expression) use (&$savedParsedExpression) {
89-
$savedParsedExpression = $expression;
90-
}))
91-
;
92-
93-
$parsedExpression = $expressionLanguage->parse('1 + 1', array());
94-
$this->assertSame($savedParsedExpression, $parsedExpression);
95-
}
96-
97-
/**
98-
* @expectedException \InvalidArgumentException
99-
* @expectedExceptionMessage Cache argument has to implement Psr\Cache\CacheItemPoolInterface.
100-
*/
101-
public function testWrongCacheImplementation()
102-
{
103-
$cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemSpoolInterface')->getMock();
104-
$expressionLanguage = new ExpressionLanguage($cacheMock);
105-
}
106-
10766
public function testConstantFunction()
10867
{
10968
$expressionLanguage = new ExpressionLanguage();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy