diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-06-22 21:23:30 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-06-22 21:25:44 +0100 |
| commit | 50b23b0d007a750c2e92c88071f2224cb81db10e (patch) | |
| tree | 198acc94e55214451e0975bfd410b082f1ef6df5 /vendor/symfony | |
| parent | 875080585841996f3fd1f780503fec8c397e750c (diff) | |
| download | webtrees-50b23b0d007a750c2e92c88071f2224cb81db10e.tar.gz webtrees-50b23b0d007a750c2e92c88071f2224cb81db10e.tar.bz2 webtrees-50b23b0d007a750c2e92c88071f2224cb81db10e.zip | |
Fix: #2359 - updated language negotiation for chinese in fisharebest/localization
Diffstat (limited to 'vendor/symfony')
60 files changed, 445 insertions, 418 deletions
diff --git a/vendor/symfony/cache-contracts/composer.json b/vendor/symfony/cache-contracts/composer.json index d5d7e99b9f..4e0bd1a422 100644 --- a/vendor/symfony/cache-contracts/composer.json +++ b/vendor/symfony/cache-contracts/composer.json @@ -16,10 +16,10 @@ } ], "require": { - "php": "^7.1.3" + "php": "^7.1.3", + "psr/cache": "^1.0" }, "suggest": { - "psr/cache": "", "symfony/cache-implementation": "" }, "autoload": { diff --git a/vendor/symfony/cache/Adapter/ArrayAdapter.php b/vendor/symfony/cache/Adapter/ArrayAdapter.php index bbb1f846e4..defa48eed9 100644 --- a/vendor/symfony/cache/Adapter/ArrayAdapter.php +++ b/vendor/symfony/cache/Adapter/ArrayAdapter.php @@ -59,7 +59,8 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter // ArrayAdapter works in memory, we don't care about stampede protection if (INF === $beta || !$item->isHit()) { - $this->save($item->set($callback($item))); + $save = true; + $this->save($item->set($callback($item, $save))); } return $item->get(); diff --git a/vendor/symfony/cache/Adapter/NullAdapter.php b/vendor/symfony/cache/Adapter/NullAdapter.php index f1bdd2bf71..54cd453565 100644 --- a/vendor/symfony/cache/Adapter/NullAdapter.php +++ b/vendor/symfony/cache/Adapter/NullAdapter.php @@ -42,7 +42,9 @@ class NullAdapter implements AdapterInterface, CacheInterface */ public function get(string $key, callable $callback, float $beta = null, array &$metadata = null) { - return $callback(($this->createCacheItem)($key)); + $save = true; + + return $callback(($this->createCacheItem)($key), $save); } /** diff --git a/vendor/symfony/cache/Adapter/ProxyAdapter.php b/vendor/symfony/cache/Adapter/ProxyAdapter.php index 8340bdf034..cf51b90d8d 100644 --- a/vendor/symfony/cache/Adapter/ProxyAdapter.php +++ b/vendor/symfony/cache/Adapter/ProxyAdapter.php @@ -103,9 +103,9 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa return $this->doGet($this, $key, $callback, $beta, $metadata); } - return $this->pool->get($this->getId($key), function ($innerItem) use ($key, $callback) { + return $this->pool->get($this->getId($key), function ($innerItem, bool &$save) use ($key, $callback) { $item = ($this->createCacheItem)($key, $innerItem); - $item->set($value = $callback($item)); + $item->set($value = $callback($item, $save)); ($this->setInnerItem)($innerItem, (array) $item); return $value; diff --git a/vendor/symfony/cache/Adapter/TraceableAdapter.php b/vendor/symfony/cache/Adapter/TraceableAdapter.php index 5c294d03fd..660acf54d7 100644 --- a/vendor/symfony/cache/Adapter/TraceableAdapter.php +++ b/vendor/symfony/cache/Adapter/TraceableAdapter.php @@ -45,10 +45,10 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt } $isHit = true; - $callback = function (CacheItem $item) use ($callback, &$isHit) { + $callback = function (CacheItem $item, bool &$save) use ($callback, &$isHit) { $isHit = $item->isHit(); - return $callback($item); + return $callback($item, $save); }; $event = $this->start(__FUNCTION__); diff --git a/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php b/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php index 2b66d2bea0..93318ffd48 100644 --- a/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php +++ b/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php @@ -12,9 +12,12 @@ namespace Symfony\Component\Cache\Tests\Adapter; use Cache\IntegrationTests\CachePoolTest; +use PHPUnit\Framework\Assert; +use Psr\Cache\CacheItemInterface; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\CacheItem; use Symfony\Component\Cache\PruneableInterface; +use Symfony\Contracts\Cache\CallbackInterface; abstract class AdapterTestCase extends CachePoolTest { @@ -57,6 +60,22 @@ abstract class AdapterTestCase extends CachePoolTest $this->assertSame($value, $item->get()); }, INF)); $this->assertFalse($isHit); + + $this->assertSame($value, $cache->get('bar', new class($value) implements CallbackInterface { + private $value; + + public function __construct(int $value) + { + $this->value = $value; + } + + public function __invoke(CacheItemInterface $item, bool &$save) + { + Assert::assertSame('bar', $item->getKey()); + + return $this->value; + } + })); } public function testRecursiveGet() diff --git a/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php index 61b039b57b..46bbef4c31 100644 --- a/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php @@ -84,7 +84,7 @@ class ChainAdapterTest extends AdapterTestCase $pruneable ->expects($this->atLeastOnce()) ->method('prune') - ->will($this->returnValue(true)); + ->willReturn(true); return $pruneable; } @@ -101,7 +101,7 @@ class ChainAdapterTest extends AdapterTestCase $pruneable ->expects($this->atLeastOnce()) ->method('prune') - ->will($this->returnValue(false)); + ->willReturn(false); return $pruneable; } diff --git a/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php index a339790862..2a0266ef56 100644 --- a/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php @@ -76,7 +76,7 @@ class TagAwareAdapterTest extends AdapterTestCase $pruneable ->expects($this->atLeastOnce()) ->method('prune') - ->will($this->returnValue(true)); + ->willReturn(true); return $pruneable; } @@ -93,7 +93,7 @@ class TagAwareAdapterTest extends AdapterTestCase $pruneable ->expects($this->atLeastOnce()) ->method('prune') - ->will($this->returnValue(false)); + ->willReturn(false); return $pruneable; } diff --git a/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php b/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php index 806bb7633b..0af56cd30d 100644 --- a/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php @@ -79,7 +79,7 @@ class ChainCacheTest extends CacheTestCase $pruneable ->expects($this->atLeastOnce()) ->method('prune') - ->will($this->returnValue(true)); + ->willReturn(true); return $pruneable; } @@ -96,7 +96,7 @@ class ChainCacheTest extends CacheTestCase $pruneable ->expects($this->atLeastOnce()) ->method('prune') - ->will($this->returnValue(false)); + ->willReturn(false); return $pruneable; } diff --git a/vendor/symfony/cache/Traits/ArrayTrait.php b/vendor/symfony/cache/Traits/ArrayTrait.php index 8ae9cad59b..d29b528b96 100644 --- a/vendor/symfony/cache/Traits/ArrayTrait.php +++ b/vendor/symfony/cache/Traits/ArrayTrait.php @@ -129,7 +129,7 @@ trait ArrayTrait } catch (\Exception $e) { $type = \is_object($value) ? \get_class($value) : \gettype($value); $message = sprintf('Failed to save key "{key}" of type %s: %s', $type, $e->getMessage()); - CacheItem::log($this->logger, $message, ['key' => substr($id, \strlen($this->namespace)), 'exception' => $e]); + CacheItem::log($this->logger, $message, ['key' => $key, 'exception' => $e]); return; } diff --git a/vendor/symfony/debug/Tests/ErrorHandlerTest.php b/vendor/symfony/debug/Tests/ErrorHandlerTest.php index 43da7f2766..f758d21e0e 100644 --- a/vendor/symfony/debug/Tests/ErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/ErrorHandlerTest.php @@ -234,7 +234,7 @@ class ErrorHandlerTest extends TestCase $logger ->expects($this->once()) ->method('log') - ->will($this->returnCallback($warnArgCheck)) + ->willReturnCallback($warnArgCheck) ; $handler = ErrorHandler::register(); @@ -262,7 +262,7 @@ class ErrorHandlerTest extends TestCase $logger ->expects($this->once()) ->method('log') - ->will($this->returnCallback($logArgCheck)) + ->willReturnCallback($logArgCheck) ; $handler = ErrorHandler::register(); @@ -318,7 +318,7 @@ class ErrorHandlerTest extends TestCase $logger ->expects($this->once()) ->method('log') - ->will($this->returnCallback($logArgCheck)) + ->willReturnCallback($logArgCheck) ; $handler = new ErrorHandler(); @@ -346,7 +346,7 @@ class ErrorHandlerTest extends TestCase $logger ->expects($this->exactly(2)) ->method('log') - ->will($this->returnCallback($logArgCheck)) + ->willReturnCallback($logArgCheck) ; $handler->setDefaultLogger($logger, E_ERROR); @@ -462,7 +462,7 @@ class ErrorHandlerTest extends TestCase $logger ->expects($this->once()) ->method('log') - ->will($this->returnCallback($logArgCheck)) + ->willReturnCallback($logArgCheck) ; $handler->setDefaultLogger($logger, E_PARSE); diff --git a/vendor/symfony/event-dispatcher-contracts/EventDispatcherInterface.php b/vendor/symfony/event-dispatcher-contracts/EventDispatcherInterface.php index 9b1a69add2..2d470af920 100644 --- a/vendor/symfony/event-dispatcher-contracts/EventDispatcherInterface.php +++ b/vendor/symfony/event-dispatcher-contracts/EventDispatcherInterface.php @@ -23,7 +23,7 @@ if (interface_exists(PsrEventDispatcherInterface::class)) { * Dispatches an event to all registered listeners. * * For BC with Symfony 4, the $eventName argument is not declared explicitly on the - * signature of the method. Implementations that are not bound by this BC contraint + * signature of the method. Implementations that are not bound by this BC constraint * MUST declare it explicitly, as allowed by PHP. * * @param object $event The event to pass to the event handlers/listeners @@ -44,7 +44,7 @@ if (interface_exists(PsrEventDispatcherInterface::class)) { * Dispatches an event to all registered listeners. * * For BC with Symfony 4, the $eventName argument is not declared explicitly on the - * signature of the method. Implementations that are not bound by this BC contraint + * signature of the method. Implementations that are not bound by this BC constraint * MUST declare it explicitly, as allowed by PHP. * * @param object $event The event to pass to the event handlers/listeners diff --git a/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php index c896facc14..f6556f0b1b 100644 --- a/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php +++ b/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php @@ -43,7 +43,7 @@ class ImmutableEventDispatcherTest extends TestCase $this->innerDispatcher->expects($this->once()) ->method('dispatch') ->with($event, 'event') - ->will($this->returnValue('result')); + ->willReturn('result'); $this->assertSame('result', $this->dispatcher->dispatch($event, 'event')); } @@ -53,7 +53,7 @@ class ImmutableEventDispatcherTest extends TestCase $this->innerDispatcher->expects($this->once()) ->method('getListeners') ->with('event') - ->will($this->returnValue('result')); + ->willReturn('result'); $this->assertSame('result', $this->dispatcher->getListeners('event')); } @@ -63,7 +63,7 @@ class ImmutableEventDispatcherTest extends TestCase $this->innerDispatcher->expects($this->once()) ->method('hasListeners') ->with('event') - ->will($this->returnValue('result')); + ->willReturn('result'); $this->assertSame('result', $this->dispatcher->hasListeners('event')); } diff --git a/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php b/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php index f9c9dae42b..41a1f578d4 100644 --- a/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php +++ b/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php @@ -36,18 +36,18 @@ class ExpressionLanguageTest extends TestCase $cacheItemMock ->expects($this->exactly(2)) ->method('get') - ->will($this->returnCallback(function () use (&$savedParsedExpression) { + ->willReturnCallback(function () use (&$savedParsedExpression) { return $savedParsedExpression; - })) + }) ; $cacheItemMock ->expects($this->exactly(1)) ->method('set') ->with($this->isInstanceOf(ParsedExpression::class)) - ->will($this->returnCallback(function ($parsedExpression) use (&$savedParsedExpression) { + ->willReturnCallback(function ($parsedExpression) use (&$savedParsedExpression) { $savedParsedExpression = $parsedExpression; - })) + }) ; $cacheMock @@ -172,18 +172,18 @@ class ExpressionLanguageTest extends TestCase $cacheItemMock ->expects($this->exactly(2)) ->method('get') - ->will($this->returnCallback(function () use (&$savedParsedExpression) { + ->willReturnCallback(function () use (&$savedParsedExpression) { return $savedParsedExpression; - })) + }) ; $cacheItemMock ->expects($this->exactly(1)) ->method('set') ->with($this->isInstanceOf(ParsedExpression::class)) - ->will($this->returnCallback(function ($parsedExpression) use (&$savedParsedExpression) { + ->willReturnCallback(function ($parsedExpression) use (&$savedParsedExpression) { $savedParsedExpression = $parsedExpression; - })) + }) ; $cacheMock diff --git a/vendor/symfony/http-foundation/JsonResponse.php b/vendor/symfony/http-foundation/JsonResponse.php index 817cbb9afc..4dae091faa 100644 --- a/vendor/symfony/http-foundation/JsonResponse.php +++ b/vendor/symfony/http-foundation/JsonResponse.php @@ -148,6 +148,10 @@ class JsonResponse extends Response throw $e; } + if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $this->encodingOptions)) { + return $this->setJson($data); + } + if (JSON_ERROR_NONE !== json_last_error()) { throw new \InvalidArgumentException(json_last_error_msg()); } diff --git a/vendor/symfony/http-foundation/RedirectResponse.php b/vendor/symfony/http-foundation/RedirectResponse.php index f685856584..8d04aa42c9 100644 --- a/vendor/symfony/http-foundation/RedirectResponse.php +++ b/vendor/symfony/http-foundation/RedirectResponse.php @@ -42,7 +42,7 @@ class RedirectResponse extends Response throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status)); } - if (301 == $status && !\array_key_exists('cache-control', $headers)) { + if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, \CASE_LOWER))) { $this->headers->remove('cache-control'); } } diff --git a/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php b/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php index 64c3e73ee2..5f6a8ac088 100644 --- a/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php @@ -91,6 +91,10 @@ class RedirectResponseTest extends TestCase $this->assertFalse($response->headers->hasCacheControlDirective('no-cache')); $this->assertTrue($response->headers->hasCacheControlDirective('max-age')); + $response = new RedirectResponse('foo.bar', 301, ['Cache-Control' => 'max-age=86400']); + $this->assertFalse($response->headers->hasCacheControlDirective('no-cache')); + $this->assertTrue($response->headers->hasCacheControlDirective('max-age')); + $response = new RedirectResponse('foo.bar', 302); $this->assertTrue($response->headers->hasCacheControlDirective('no-cache')); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php index 5c72a89aa5..2393ddf182 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php @@ -62,7 +62,7 @@ class MemcachedSessionHandlerTest extends TestCase $this->memcached ->expects($this->once()) ->method('quit') - ->will($this->returnValue(true)) + ->willReturn(true) ; $this->assertTrue($this->storage->close()); @@ -85,7 +85,7 @@ class MemcachedSessionHandlerTest extends TestCase ->expects($this->once()) ->method('set') ->with(self::PREFIX.'id', 'data', $this->equalTo(time() + self::TTL, 2)) - ->will($this->returnValue(true)) + ->willReturn(true) ; $this->assertTrue($this->storage->write('id', 'data')); @@ -97,7 +97,7 @@ class MemcachedSessionHandlerTest extends TestCase ->expects($this->once()) ->method('delete') ->with(self::PREFIX.'id') - ->will($this->returnValue(true)) + ->willReturn(true) ; $this->assertTrue($this->storage->destroy('id')); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php index 1c0f3ca663..6dc5b0cb5c 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php @@ -38,11 +38,11 @@ class MigratingSessionHandlerTest extends TestCase { $this->currentHandler->expects($this->once()) ->method('close') - ->will($this->returnValue(true)); + ->willReturn(true); $this->writeOnlyHandler->expects($this->once()) ->method('close') - ->will($this->returnValue(false)); + ->willReturn(false); $result = $this->dualHandler->close(); @@ -56,12 +56,12 @@ class MigratingSessionHandlerTest extends TestCase $this->currentHandler->expects($this->once()) ->method('destroy') ->with($sessionId) - ->will($this->returnValue(true)); + ->willReturn(true); $this->writeOnlyHandler->expects($this->once()) ->method('destroy') ->with($sessionId) - ->will($this->returnValue(false)); + ->willReturn(false); $result = $this->dualHandler->destroy($sessionId); @@ -75,12 +75,12 @@ class MigratingSessionHandlerTest extends TestCase $this->currentHandler->expects($this->once()) ->method('gc') ->with($maxlifetime) - ->will($this->returnValue(true)); + ->willReturn(true); $this->writeOnlyHandler->expects($this->once()) ->method('gc') ->with($maxlifetime) - ->will($this->returnValue(false)); + ->willReturn(false); $result = $this->dualHandler->gc($maxlifetime); $this->assertTrue($result); @@ -94,12 +94,12 @@ class MigratingSessionHandlerTest extends TestCase $this->currentHandler->expects($this->once()) ->method('open') ->with($savePath, $sessionName) - ->will($this->returnValue(true)); + ->willReturn(true); $this->writeOnlyHandler->expects($this->once()) ->method('open') ->with($savePath, $sessionName) - ->will($this->returnValue(false)); + ->willReturn(false); $result = $this->dualHandler->open($savePath, $sessionName); @@ -114,7 +114,7 @@ class MigratingSessionHandlerTest extends TestCase $this->currentHandler->expects($this->once()) ->method('read') ->with($sessionId) - ->will($this->returnValue($readValue)); + ->willReturn($readValue); $this->writeOnlyHandler->expects($this->never()) ->method('read') @@ -133,12 +133,12 @@ class MigratingSessionHandlerTest extends TestCase $this->currentHandler->expects($this->once()) ->method('write') ->with($sessionId, $data) - ->will($this->returnValue(true)); + ->willReturn(true); $this->writeOnlyHandler->expects($this->once()) ->method('write') ->with($sessionId, $data) - ->will($this->returnValue(false)); + ->willReturn(false); $result = $this->dualHandler->write($sessionId, $data); @@ -153,7 +153,7 @@ class MigratingSessionHandlerTest extends TestCase $this->currentHandler->expects($this->once()) ->method('read') ->with($sessionId) - ->will($this->returnValue($readValue)); + ->willReturn($readValue); $this->writeOnlyHandler->expects($this->never()) ->method('read') @@ -172,12 +172,12 @@ class MigratingSessionHandlerTest extends TestCase $this->currentHandler->expects($this->once()) ->method('write') ->with($sessionId, $data) - ->will($this->returnValue(true)); + ->willReturn(true); $this->writeOnlyHandler->expects($this->once()) ->method('write') ->with($sessionId, $data) - ->will($this->returnValue(false)); + ->willReturn(false); $result = $this->dualHandler->updateTimestamp($sessionId, $data); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index 891516d523..5fcdad9b58 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -77,7 +77,7 @@ class MongoDbSessionHandlerTest extends TestCase $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); + ->willReturn($collection); // defining the timeout before the actual method call // allows to test for "greater than" values in the $criteria @@ -85,7 +85,7 @@ class MongoDbSessionHandlerTest extends TestCase $collection->expects($this->once()) ->method('findOne') - ->will($this->returnCallback(function ($criteria) use ($testTimeout) { + ->willReturnCallback(function ($criteria) use ($testTimeout) { $this->assertArrayHasKey($this->options['id_field'], $criteria); $this->assertEquals($criteria[$this->options['id_field']], 'foo'); @@ -100,7 +100,7 @@ class MongoDbSessionHandlerTest extends TestCase $this->options['expiry_field'] => new \MongoDB\BSON\UTCDateTime(), $this->options['data_field'] => new \MongoDB\BSON\Binary('bar', \MongoDB\BSON\Binary::TYPE_OLD_BINARY), ]; - })); + }); $this->assertEquals('bar', $this->storage->read('foo')); } @@ -112,11 +112,11 @@ class MongoDbSessionHandlerTest extends TestCase $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); + ->willReturn($collection); $collection->expects($this->once()) ->method('updateOne') - ->will($this->returnCallback(function ($criteria, $updateData, $options) { + ->willReturnCallback(function ($criteria, $updateData, $options) { $this->assertEquals([$this->options['id_field'] => 'foo'], $criteria); $this->assertEquals(['upsert' => true], $options); @@ -127,7 +127,7 @@ class MongoDbSessionHandlerTest extends TestCase $this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $data[$this->options['time_field']]); $this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $data[$this->options['expiry_field']]); $this->assertGreaterThanOrEqual($expectedExpiry, round((string) $data[$this->options['expiry_field']] / 1000)); - })); + }); $this->assertTrue($this->storage->write('foo', 'bar')); } @@ -139,15 +139,15 @@ class MongoDbSessionHandlerTest extends TestCase $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); + ->willReturn($collection); $data = []; $collection->expects($this->exactly(2)) ->method('updateOne') - ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) { + ->willReturnCallback(function ($criteria, $updateData, $options) use (&$data) { $data = $updateData; - })); + }); $this->storage->write('foo', 'bar'); $this->storage->write('foo', 'foobar'); @@ -162,7 +162,7 @@ class MongoDbSessionHandlerTest extends TestCase $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); + ->willReturn($collection); $collection->expects($this->once()) ->method('deleteOne') @@ -178,14 +178,14 @@ class MongoDbSessionHandlerTest extends TestCase $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); + ->willReturn($collection); $collection->expects($this->once()) ->method('deleteMany') - ->will($this->returnCallback(function ($criteria) { + ->willReturnCallback(function ($criteria) { $this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $criteria[$this->options['expiry_field']]['$lt']); $this->assertGreaterThanOrEqual(time() - 1, round((string) $criteria[$this->options['expiry_field']]['$lt'] / 1000)); - })); + }); $this->assertTrue($this->storage->gc(1)); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index 8aa84cff81..380b4d7da4 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -143,7 +143,7 @@ class PdoSessionHandlerTest extends TestCase $stream = $this->createStream($content); $pdo->prepareResult->expects($this->once())->method('fetchAll') - ->will($this->returnValue([[$stream, 42, time()]])); + ->willReturn([[$stream, 42, time()]]); $storage = new PdoSessionHandler($pdo); $result = $storage->read('foo'); @@ -170,14 +170,14 @@ class PdoSessionHandlerTest extends TestCase $exception = null; $selectStmt->expects($this->atLeast(2))->method('fetchAll') - ->will($this->returnCallback(function () use (&$exception, $stream) { + ->willReturnCallback(function () use (&$exception, $stream) { return $exception ? [[$stream, 42, time()]] : []; - })); + }); $insertStmt->expects($this->once())->method('execute') - ->will($this->returnCallback(function () use (&$exception) { + ->willReturnCallback(function () use (&$exception) { throw $exception = new \PDOException('', '23'); - })); + }); $storage = new PdoSessionHandler($pdo); $result = $storage->read('foo'); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php index 0459a8ce97..b6e0da99dd 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php @@ -50,7 +50,7 @@ class SessionHandlerProxyTest extends TestCase { $this->mock->expects($this->once()) ->method('open') - ->will($this->returnValue(true)); + ->willReturn(true); $this->assertFalse($this->proxy->isActive()); $this->proxy->open('name', 'id'); @@ -61,7 +61,7 @@ class SessionHandlerProxyTest extends TestCase { $this->mock->expects($this->once()) ->method('open') - ->will($this->returnValue(false)); + ->willReturn(false); $this->assertFalse($this->proxy->isActive()); $this->proxy->open('name', 'id'); @@ -72,7 +72,7 @@ class SessionHandlerProxyTest extends TestCase { $this->mock->expects($this->once()) ->method('close') - ->will($this->returnValue(true)); + ->willReturn(true); $this->assertFalse($this->proxy->isActive()); $this->proxy->close(); @@ -83,7 +83,7 @@ class SessionHandlerProxyTest extends TestCase { $this->mock->expects($this->once()) ->method('close') - ->will($this->returnValue(false)); + ->willReturn(false); $this->assertFalse($this->proxy->isActive()); $this->proxy->close(); diff --git a/vendor/symfony/http-kernel/Client.php b/vendor/symfony/http-kernel/Client.php index ed1e1382ea..66ce0649f0 100644 --- a/vendor/symfony/http-kernel/Client.php +++ b/vendor/symfony/http-kernel/Client.php @@ -11,8 +11,191 @@ namespace Symfony\Component\HttpKernel; -@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', Client::class, HttpKernelBrowser::class), E_USER_DEPRECATED); +use Symfony\Component\BrowserKit\AbstractBrowser; +use Symfony\Component\BrowserKit\CookieJar; +use Symfony\Component\BrowserKit\History; +use Symfony\Component\BrowserKit\Request as DomRequest; +use Symfony\Component\BrowserKit\Response as DomResponse; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; -class Client extends HttpKernelBrowser +/** + * Client simulates a browser and makes requests to an HttpKernel instance. + * + * @deprecated since Symfony 4.3, use HttpKernelBrowser instead. + */ +class Client extends AbstractBrowser { + protected $kernel; + private $catchExceptions = true; + + /** + * @param HttpKernelInterface $kernel An HttpKernel instance + * @param array $server The server parameters (equivalent of $_SERVER) + * @param History $history A History instance to store the browser history + * @param CookieJar $cookieJar A CookieJar instance to store the cookies + */ + public function __construct(HttpKernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null) + { + // These class properties must be set before calling the parent constructor, as it may depend on it. + $this->kernel = $kernel; + $this->followRedirects = false; + + parent::__construct($server, $history, $cookieJar); + } + + /** + * Sets whether to catch exceptions when the kernel is handling a request. + * + * @param bool $catchExceptions Whether to catch exceptions + */ + public function catchExceptions($catchExceptions) + { + $this->catchExceptions = $catchExceptions; + } + + /** + * Makes a request. + * + * @return Response A Response instance + */ + protected function doRequest($request) + { + $response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $this->catchExceptions); + + if ($this->kernel instanceof TerminableInterface) { + $this->kernel->terminate($request, $response); + } + + return $response; + } + + /** + * Returns the script to execute when the request must be insulated. + * + * @return string + */ + protected function getScript($request) + { + $kernel = var_export(serialize($this->kernel), true); + $request = var_export(serialize($request), true); + + $errorReporting = error_reporting(); + + $requires = ''; + foreach (get_declared_classes() as $class) { + if (0 === strpos($class, 'ComposerAutoloaderInit')) { + $r = new \ReflectionClass($class); + $file = \dirname(\dirname($r->getFileName())).'/autoload.php'; + if (file_exists($file)) { + $requires .= 'require_once '.var_export($file, true).";\n"; + } + } + } + + if (!$requires) { + throw new \RuntimeException('Composer autoloader not found.'); + } + + $code = <<<EOF +<?php + +error_reporting($errorReporting); + +$requires + +\$kernel = unserialize($kernel); +\$request = unserialize($request); +EOF; + + return $code.$this->getHandleScript(); + } + + protected function getHandleScript() + { + return <<<'EOF' +$response = $kernel->handle($request); + +if ($kernel instanceof Symfony\Component\HttpKernel\TerminableInterface) { + $kernel->terminate($request, $response); +} + +echo serialize($response); +EOF; + } + + /** + * Converts the BrowserKit request to a HttpKernel request. + * + * @return Request A Request instance + */ + protected function filterRequest(DomRequest $request) + { + $httpRequest = Request::create($request->getUri(), $request->getMethod(), $request->getParameters(), $request->getCookies(), $request->getFiles(), $request->getServer(), $request->getContent()); + + foreach ($this->filterFiles($httpRequest->files->all()) as $key => $value) { + $httpRequest->files->set($key, $value); + } + + return $httpRequest; + } + + /** + * Filters an array of files. + * + * This method created test instances of UploadedFile so that the move() + * method can be called on those instances. + * + * If the size of a file is greater than the allowed size (from php.ini) then + * an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE. + * + * @see UploadedFile + * + * @return array An array with all uploaded files marked as already moved + */ + protected function filterFiles(array $files) + { + $filtered = []; + foreach ($files as $key => $value) { + if (\is_array($value)) { + $filtered[$key] = $this->filterFiles($value); + } elseif ($value instanceof UploadedFile) { + if ($value->isValid() && $value->getSize() > UploadedFile::getMaxFilesize()) { + $filtered[$key] = new UploadedFile( + '', + $value->getClientOriginalName(), + $value->getClientMimeType(), + UPLOAD_ERR_INI_SIZE, + true + ); + } else { + $filtered[$key] = new UploadedFile( + $value->getPathname(), + $value->getClientOriginalName(), + $value->getClientMimeType(), + $value->getError(), + true + ); + } + } + } + + return $filtered; + } + + /** + * Converts the HttpKernel response to a BrowserKit response. + * + * @return DomResponse A DomResponse instance + */ + protected function filterResponse($response) + { + // this is needed to support StreamedResponse + ob_start(); + $response->sendContent(); + $content = ob_get_clean(); + + return new DomResponse($content, $response->getStatusCode(), $response->headers->all()); + } } diff --git a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php index 54defbf1d1..eb24167529 100644 --- a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php +++ b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php @@ -68,7 +68,7 @@ class FileLinkFormatter */ public function __sleep(): array { - $this->getFileLinkFormat(); + $this->fileLinkFormat = $this->getFileLinkFormat(); return ['fileLinkFormat']; } @@ -87,17 +87,19 @@ class FileLinkFormatter private function getFileLinkFormat() { + if ($this->fileLinkFormat) { + return $this->fileLinkFormat; + } + if ($this->requestStack && $this->baseDir && $this->urlFormat) { $request = $this->requestStack->getMasterRequest(); if ($request instanceof Request && (!$this->urlFormat instanceof \Closure || $this->urlFormat = ($this->urlFormat)())) { - $this->fileLinkFormat = [ + return [ $request->getSchemeAndHttpHost().$request->getBasePath().$this->urlFormat, $this->baseDir.\DIRECTORY_SEPARATOR, '', ]; } } - - return $this->fileLinkFormat; } } diff --git a/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php b/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php index 6659e21793..b28ad7b83e 100644 --- a/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php +++ b/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php @@ -19,7 +19,10 @@ use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\Debug\ExceptionHandler; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; +use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Event\KernelEvent; use Symfony\Component\HttpKernel\KernelEvents; @@ -37,6 +40,7 @@ class DebugHandlersListener implements EventSubscriberInterface private $scream; private $fileLinkFormat; private $scope; + private $charset; private $firstCall = true; private $hasTerminatedWithException; @@ -49,7 +53,7 @@ class DebugHandlersListener implements EventSubscriberInterface * @param string|FileLinkFormatter|null $fileLinkFormat The format for links to source files * @param bool $scope Enables/disables scoping mode */ - public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, ?int $throwAt = E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true) + public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, ?int $throwAt = E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true, string $charset = null) { $this->exceptionHandler = $exceptionHandler; $this->logger = $logger; @@ -58,6 +62,7 @@ class DebugHandlersListener implements EventSubscriberInterface $this->scream = $scream; $this->fileLinkFormat = $fileLinkFormat; $this->scope = $scope; + $this->charset = $charset; } /** @@ -144,6 +149,26 @@ class DebugHandlersListener implements EventSubscriberInterface } } + /** + * @internal + */ + public function onKernelException(GetResponseForExceptionEvent $event) + { + if (!$this->hasTerminatedWithException || !$event->isMasterRequest()) { + return; + } + + $debug = $this->scream && $this->scope; + $controller = function (Request $request) use ($debug) { + $e = $request->attributes->get('exception'); + $handler = new ExceptionHandler($debug, $this->charset, $this->fileLinkFormat); + + return new Response($handler->getHtml($e), $e->getStatusCode(), $e->getHeaders()); + }; + + (new ExceptionListener($controller, $this->logger, $debug))->onKernelException($event); + } + public static function getSubscribedEvents() { $events = [KernelEvents::REQUEST => ['configure', 2048]]; @@ -152,6 +177,8 @@ class DebugHandlersListener implements EventSubscriberInterface $events[ConsoleEvents::COMMAND] = ['configure', 2048]; } + $events[KernelEvents::EXCEPTION] = ['onKernelException', -2048]; + return $events; } } diff --git a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php index 8e31ecc944..f8044537a8 100644 --- a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php +++ b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php @@ -13,7 +13,6 @@ namespace Symfony\Component\HttpKernel\EventListener; use Psr\Log\LoggerInterface; use Symfony\Component\Debug\Exception\FlattenException; -use Symfony\Component\Debug\ExceptionHandler; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; @@ -34,17 +33,12 @@ class ExceptionListener implements EventSubscriberInterface protected $controller; protected $logger; protected $debug; - private $charset; - private $fileLinkFormat; - private $isTerminating = false; - public function __construct($controller, LoggerInterface $logger = null, $debug = false, string $charset = null, $fileLinkFormat = null) + public function __construct($controller, LoggerInterface $logger = null, $debug = false) { $this->controller = $controller; $this->logger = $logger; $this->debug = $debug; - $this->charset = $charset; - $this->fileLinkFormat = $fileLinkFormat; } public function logKernelException(GetResponseForExceptionEvent $event) @@ -61,16 +55,9 @@ class ExceptionListener implements EventSubscriberInterface public function onKernelException(GetResponseForExceptionEvent $event) { if (null === $this->controller) { - if (!$event->isMasterRequest()) { - return; - } - if (!$this->isTerminating) { - $this->isTerminating = true; - - return; - } - $this->isTerminating = false; + return; } + $exception = $event->getException(); $request = $this->duplicateRequest($exception, $event->getRequest()); $eventDispatcher = \func_num_args() > 2 ? func_get_arg(2) : null; @@ -107,11 +94,6 @@ class ExceptionListener implements EventSubscriberInterface } } - public function reset() - { - $this->isTerminating = false; - } - public static function getSubscribedEvents() { return [ @@ -150,12 +132,8 @@ class ExceptionListener implements EventSubscriberInterface protected function duplicateRequest(\Exception $exception, Request $request) { $attributes = [ - 'exception' => $exception = FlattenException::create($exception), - '_controller' => $this->controller ?: function () use ($exception) { - $handler = new ExceptionHandler($this->debug, $this->charset, $this->fileLinkFormat); - - return new Response($handler->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders()); - }, + '_controller' => $this->controller, + 'exception' => FlattenException::create($exception), 'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null, ]; $request = $request->duplicate(null, null, $attributes); diff --git a/vendor/symfony/http-kernel/HttpKernelBrowser.php b/vendor/symfony/http-kernel/HttpKernelBrowser.php index 76f964ce6a..ab52df14ed 100644 --- a/vendor/symfony/http-kernel/HttpKernelBrowser.php +++ b/vendor/symfony/http-kernel/HttpKernelBrowser.php @@ -11,15 +11,6 @@ namespace Symfony\Component\HttpKernel; -use Symfony\Component\BrowserKit\AbstractBrowser; -use Symfony\Component\BrowserKit\CookieJar; -use Symfony\Component\BrowserKit\History; -use Symfony\Component\BrowserKit\Request as DomRequest; -use Symfony\Component\BrowserKit\Response as DomResponse; -use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - /** * Client simulates a browser and makes requests to an HttpKernel instance. * @@ -28,177 +19,6 @@ use Symfony\Component\HttpFoundation\Response; * @method Request getRequest() A Request instance * @method Response getResponse() A Response instance */ -class HttpKernelBrowser extends AbstractBrowser +class HttpKernelBrowser extends Client { - protected $kernel; - private $catchExceptions = true; - - /** - * @param HttpKernelInterface $kernel An HttpKernel instance - * @param array $server The server parameters (equivalent of $_SERVER) - * @param History $history A History instance to store the browser history - * @param CookieJar $cookieJar A CookieJar instance to store the cookies - */ - public function __construct(HttpKernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null) - { - // These class properties must be set before calling the parent constructor, as it may depend on it. - $this->kernel = $kernel; - $this->followRedirects = false; - - parent::__construct($server, $history, $cookieJar); - } - - /** - * Sets whether to catch exceptions when the kernel is handling a request. - * - * @param bool $catchExceptions Whether to catch exceptions - */ - public function catchExceptions($catchExceptions) - { - $this->catchExceptions = $catchExceptions; - } - - /** - * Makes a request. - * - * @return Response A Response instance - */ - protected function doRequest($request) - { - $response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $this->catchExceptions); - - if ($this->kernel instanceof TerminableInterface) { - $this->kernel->terminate($request, $response); - } - - return $response; - } - - /** - * Returns the script to execute when the request must be insulated. - * - * @return string - */ - protected function getScript($request) - { - $kernel = var_export(serialize($this->kernel), true); - $request = var_export(serialize($request), true); - - $errorReporting = error_reporting(); - - $requires = ''; - foreach (get_declared_classes() as $class) { - if (0 === strpos($class, 'ComposerAutoloaderInit')) { - $r = new \ReflectionClass($class); - $file = \dirname(\dirname($r->getFileName())).'/autoload.php'; - if (file_exists($file)) { - $requires .= 'require_once '.var_export($file, true).";\n"; - } - } - } - - if (!$requires) { - throw new \RuntimeException('Composer autoloader not found.'); - } - - $code = <<<EOF -<?php - -error_reporting($errorReporting); - -$requires - -\$kernel = unserialize($kernel); -\$request = unserialize($request); -EOF; - - return $code.$this->getHandleScript(); - } - - protected function getHandleScript() - { - return <<<'EOF' -$response = $kernel->handle($request); - -if ($kernel instanceof Symfony\Component\HttpKernel\TerminableInterface) { - $kernel->terminate($request, $response); -} - -echo serialize($response); -EOF; - } - - /** - * Converts the BrowserKit request to a HttpKernel request. - * - * @return Request A Request instance - */ - protected function filterRequest(DomRequest $request) - { - $httpRequest = Request::create($request->getUri(), $request->getMethod(), $request->getParameters(), $request->getCookies(), $request->getFiles(), $request->getServer(), $request->getContent()); - - foreach ($this->filterFiles($httpRequest->files->all()) as $key => $value) { - $httpRequest->files->set($key, $value); - } - - return $httpRequest; - } - - /** - * Filters an array of files. - * - * This method created test instances of UploadedFile so that the move() - * method can be called on those instances. - * - * If the size of a file is greater than the allowed size (from php.ini) then - * an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE. - * - * @see UploadedFile - * - * @return array An array with all uploaded files marked as already moved - */ - protected function filterFiles(array $files) - { - $filtered = []; - foreach ($files as $key => $value) { - if (\is_array($value)) { - $filtered[$key] = $this->filterFiles($value); - } elseif ($value instanceof UploadedFile) { - if ($value->isValid() && $value->getSize() > UploadedFile::getMaxFilesize()) { - $filtered[$key] = new UploadedFile( - '', - $value->getClientOriginalName(), - $value->getClientMimeType(), - UPLOAD_ERR_INI_SIZE, - true - ); - } else { - $filtered[$key] = new UploadedFile( - $value->getPathname(), - $value->getClientOriginalName(), - $value->getClientMimeType(), - $value->getError(), - true - ); - } - } - } - - return $filtered; - } - - /** - * Converts the HttpKernel response to a BrowserKit response. - * - * @return DomResponse A DomResponse instance - */ - protected function filterResponse($response) - { - // this is needed to support StreamedResponse - ob_start(); - $response->sendContent(); - $content = ob_get_clean(); - - return new DomResponse($content, $response->getStatusCode(), $response->headers->all()); - } } diff --git a/vendor/symfony/http-kernel/Kernel.php b/vendor/symfony/http-kernel/Kernel.php index e0154b7d23..9c62c087ec 100644 --- a/vendor/symfony/http-kernel/Kernel.php +++ b/vendor/symfony/http-kernel/Kernel.php @@ -73,11 +73,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.3.0'; - const VERSION_ID = 40300; + const VERSION = '4.3.1'; + const VERSION_ID = 40301; const MAJOR_VERSION = 4; const MINOR_VERSION = 3; - const RELEASE_VERSION = 0; + const RELEASE_VERSION = 1; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2020'; @@ -494,7 +494,6 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl $fresh = true; } } catch (\Throwable $e) { - } catch (\Exception $e) { } finally { error_reporting($errorLevel); } @@ -563,7 +562,6 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl try { $oldContainer = include $cache->getPath(); } catch (\Throwable $e) { - } catch (\Exception $e) { } finally { error_reporting($errorLevel); } diff --git a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php b/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php index 7753600959..27e8f9f2af 100644 --- a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php +++ b/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php @@ -59,7 +59,7 @@ class CacheWarmerAggregateTest extends TestCase $warmer ->expects($this->once()) ->method('isOptional') - ->will($this->returnValue(true)); + ->willReturn(true); $warmer ->expects($this->never()) ->method('warmUp'); diff --git a/vendor/symfony/http-kernel/Tests/Config/FileLocatorTest.php b/vendor/symfony/http-kernel/Tests/Config/FileLocatorTest.php index ca1b3191bd..72b38c672a 100644 --- a/vendor/symfony/http-kernel/Tests/Config/FileLocatorTest.php +++ b/vendor/symfony/http-kernel/Tests/Config/FileLocatorTest.php @@ -23,7 +23,7 @@ class FileLocatorTest extends TestCase ->expects($this->atLeastOnce()) ->method('locateResource') ->with('@BundleName/some/path', null, true) - ->will($this->returnValue('/bundle-name/some/path')); + ->willReturn('/bundle-name/some/path'); $locator = new FileLocator($kernel); $this->assertEquals('/bundle-name/some/path', $locator->locate('@BundleName/some/path')); diff --git a/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php index 61d8bec32a..27f35b64c6 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php @@ -27,11 +27,11 @@ class ContainerControllerResolverTest extends ControllerResolverTest $container->expects($this->once()) ->method('has') ->with('foo') - ->will($this->returnValue(true)); + ->willReturn(true); $container->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue($service)) + ->willReturn($service) ; $resolver = $this->createControllerResolver(null, $container); @@ -52,11 +52,11 @@ class ContainerControllerResolverTest extends ControllerResolverTest $container->expects($this->once()) ->method('has') ->with('foo') - ->will($this->returnValue(true)); + ->willReturn(true); $container->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue($service)) + ->willReturn($service) ; $resolver = $this->createControllerResolver(null, $container); @@ -77,12 +77,12 @@ class ContainerControllerResolverTest extends ControllerResolverTest $container->expects($this->once()) ->method('has') ->with('foo') - ->will($this->returnValue(true)) + ->willReturn(true) ; $container->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue($service)) + ->willReturn($service) ; $resolver = $this->createControllerResolver(null, $container); @@ -102,12 +102,12 @@ class ContainerControllerResolverTest extends ControllerResolverTest $container->expects($this->once()) ->method('has') ->with(InvokableControllerService::class) - ->will($this->returnValue(true)) + ->willReturn(true) ; $container->expects($this->once()) ->method('get') ->with(InvokableControllerService::class) - ->will($this->returnValue($service)) + ->willReturn($service) ; $resolver = $this->createControllerResolver(null, $container); @@ -131,13 +131,13 @@ class ContainerControllerResolverTest extends ControllerResolverTest $container->expects($this->once()) ->method('has') ->with(ControllerTestService::class) - ->will($this->returnValue(false)) + ->willReturn(false) ; $container->expects($this->atLeastOnce()) ->method('getRemovedIds') ->with() - ->will($this->returnValue([ControllerTestService::class => true])) + ->willReturn([ControllerTestService::class => true]) ; $resolver = $this->createControllerResolver(null, $container); @@ -159,13 +159,13 @@ class ContainerControllerResolverTest extends ControllerResolverTest $container->expects($this->once()) ->method('has') ->with('app.my_controller') - ->will($this->returnValue(false)) + ->willReturn(false) ; $container->expects($this->atLeastOnce()) ->method('getRemovedIds') ->with() - ->will($this->returnValue(['app.my_controller' => true])) + ->willReturn(['app.my_controller' => true]) ; $resolver = $this->createControllerResolver(null, $container); diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php index e0bcc24bd7..261f098a72 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php @@ -27,8 +27,8 @@ class LoggerDataCollectorTest extends TestCase ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); - $logger->expects($this->once())->method('countErrors')->will($this->returnValue('foo')); - $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue([])); + $logger->expects($this->once())->method('countErrors')->willReturn('foo'); + $logger->expects($this->exactly(2))->method('getLogs')->willReturn([]); $c = new LoggerDataCollector($logger, __DIR__.'/'); $c->lateCollect(); @@ -56,7 +56,7 @@ class LoggerDataCollectorTest extends TestCase ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); $logger->expects($this->once())->method('countErrors')->with(null); - $logger->expects($this->exactly(2))->method('getLogs')->with(null)->will($this->returnValue([])); + $logger->expects($this->exactly(2))->method('getLogs')->with(null)->willReturn([]); $c = new LoggerDataCollector($logger, __DIR__.'/', $stack); @@ -77,7 +77,7 @@ class LoggerDataCollectorTest extends TestCase ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); $logger->expects($this->once())->method('countErrors')->with($subRequest); - $logger->expects($this->exactly(2))->method('getLogs')->with($subRequest)->will($this->returnValue([])); + $logger->expects($this->exactly(2))->method('getLogs')->with($subRequest)->willReturn([]); $c = new LoggerDataCollector($logger, __DIR__.'/', $stack); @@ -94,8 +94,8 @@ class LoggerDataCollectorTest extends TestCase ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); - $logger->expects($this->once())->method('countErrors')->will($this->returnValue($nb)); - $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue($logs)); + $logger->expects($this->once())->method('countErrors')->willReturn($nb); + $logger->expects($this->exactly(2))->method('getLogs')->willReturn($logs); $c = new LoggerDataCollector($logger); $c->lateCollect(); diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php index 793fbd319f..6756f3de42 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php @@ -44,7 +44,7 @@ class TimeDataCollectorTest extends TestCase $this->assertEquals(0, $c->getStartTime()); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock(); - $kernel->expects($this->once())->method('getStartTime')->will($this->returnValue(123456)); + $kernel->expects($this->once())->method('getStartTime')->willReturn(123456); $c = new TimeDataCollector($kernel); $request = new Request(); diff --git a/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php b/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php index ef4f4bf66a..bd70de9c3b 100644 --- a/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php +++ b/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php @@ -50,7 +50,7 @@ class TraceableEventDispatcherTest extends TestCase ->getMock(); $stopwatch->expects($this->once()) ->method('isStarted') - ->will($this->returnValue(false)); + ->willReturn(false); $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), $stopwatch); @@ -66,7 +66,7 @@ class TraceableEventDispatcherTest extends TestCase ->getMock(); $stopwatch->expects($this->once()) ->method('isStarted') - ->will($this->returnValue(true)); + ->willReturn(true); $stopwatch->expects($this->once()) ->method('stop'); $stopwatch->expects($this->once()) @@ -113,9 +113,9 @@ class TraceableEventDispatcherTest extends TestCase protected function getHttpKernel($dispatcher, $controller) { $controllerResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface')->getMock(); - $controllerResolver->expects($this->once())->method('getController')->will($this->returnValue($controller)); + $controllerResolver->expects($this->once())->method('getController')->willReturn($controller); $argumentResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface')->getMock(); - $argumentResolver->expects($this->once())->method('getArguments')->will($this->returnValue([])); + $argumentResolver->expects($this->once())->method('getArguments')->willReturn([]); return new HttpKernel($dispatcher, $controllerResolver, new RequestStack(), $argumentResolver); } diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php index 2bc84a53c8..39a1cb73b1 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php @@ -21,15 +21,15 @@ class LazyLoadingFragmentHandlerTest extends TestCase public function testRender() { $renderer = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface')->getMock(); - $renderer->expects($this->once())->method('getName')->will($this->returnValue('foo')); - $renderer->expects($this->any())->method('render')->will($this->returnValue(new Response())); + $renderer->expects($this->once())->method('getName')->willReturn('foo'); + $renderer->expects($this->any())->method('render')->willReturn(new Response()); $requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock(); - $requestStack->expects($this->any())->method('getCurrentRequest')->will($this->returnValue(Request::create('/'))); + $requestStack->expects($this->any())->method('getCurrentRequest')->willReturn(Request::create('/')); $container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock(); $container->expects($this->once())->method('has')->with('foo')->willReturn(true); - $container->expects($this->once())->method('get')->will($this->returnValue($renderer)); + $container->expects($this->once())->method('get')->willReturn($renderer); $handler = new LazyLoadingFragmentHandler($container, $requestStack, false); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php index b8b4719206..5bc1ff51ff 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php @@ -78,7 +78,7 @@ class AddRequestFormatsListenerTest extends TestCase $event->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)); + ->willReturn($request); return $event; } diff --git a/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php index f1a56e537b..1e52bce7a3 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php @@ -94,7 +94,7 @@ class DebugHandlersListenerTest extends TestCase $dispatcher = new EventDispatcher(); $listener = new DebugHandlersListener(null); $app = $this->getMockBuilder('Symfony\Component\Console\Application')->getMock(); - $app->expects($this->once())->method('getHelperSet')->will($this->returnValue(new HelperSet())); + $app->expects($this->once())->method('getHelperSet')->willReturn(new HelperSet()); $command = new Command(__FUNCTION__); $command->setApplication($app); $event = new ConsoleEvent($command, new ArgvInput(), new ConsoleOutput()); @@ -104,6 +104,7 @@ class DebugHandlersListenerTest extends TestCase $xListeners = [ KernelEvents::REQUEST => [[$listener, 'configure']], ConsoleEvents::COMMAND => [[$listener, 'configure']], + KernelEvents::EXCEPTION => [[$listener, 'onKernelException']], ]; $this->assertSame($xListeners, $dispatcher->getListeners()); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php index 18763c881b..2048fdd01c 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php @@ -116,9 +116,9 @@ class ExceptionListenerTest extends TestCase $listener = new ExceptionListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock()); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) { + $kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) { return new Response($request->getRequestFormat()); - })); + }); $request = Request::create('/'); $request->setRequestFormat('xml'); @@ -134,9 +134,9 @@ class ExceptionListenerTest extends TestCase { $dispatcher = new EventDispatcher(); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) { + $kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) { return new Response($request->getRequestFormat()); - })); + }); $listener = new ExceptionListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(), true); @@ -155,25 +155,6 @@ class ExceptionListenerTest extends TestCase $this->assertFalse($response->headers->has('content-security-policy'), 'CSP header has been removed'); $this->assertFalse($dispatcher->hasListeners(KernelEvents::RESPONSE), 'CSP removal listener has been removed'); } - - public function testNullController() - { - $listener = new ExceptionListener(null); - $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock(); - $kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) { - $controller = $request->attributes->get('_controller'); - - return $controller(); - })); - $request = Request::create('/'); - $event = new ExceptionEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, new \Exception('foo')); - - $listener->onKernelException($event); - $this->assertNull($event->getResponse()); - - $listener->onKernelException($event); - $this->assertContains('Whoops, looks like something went wrong.', $event->getResponse()->getContent()); - } } class TestLogger extends Logger implements DebugLoggerInterface diff --git a/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php index 1e9fbe23b3..925eb6f20e 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php @@ -73,7 +73,7 @@ class LocaleListenerTest extends TestCase $context->expects($this->once())->method('setParameter')->with('_locale', 'es'); $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock(); - $router->expects($this->once())->method('getContext')->will($this->returnValue($context)); + $router->expects($this->once())->method('getContext')->willReturn($context); $request = Request::create('/'); @@ -89,12 +89,12 @@ class LocaleListenerTest extends TestCase $context->expects($this->once())->method('setParameter')->with('_locale', 'es'); $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock(); - $router->expects($this->once())->method('getContext')->will($this->returnValue($context)); + $router->expects($this->once())->method('getContext')->willReturn($context); $parentRequest = Request::create('/'); $parentRequest->setLocale('es'); - $this->requestStack->expects($this->once())->method('getParentRequest')->will($this->returnValue($parentRequest)); + $this->requestStack->expects($this->once())->method('getParentRequest')->willReturn($parentRequest); $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\FinishRequestEvent')->disableOriginalConstructor()->getMock(); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php index 6e73d0e9b0..3aaff12316 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php @@ -36,7 +36,7 @@ class ProfilerListenerTest extends TestCase $profiler->expects($this->once()) ->method('collect') - ->will($this->returnValue($profile)); + ->willReturn($profile); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php index 7621ed8e65..e416bb3582 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php @@ -49,7 +49,7 @@ class RouterListenerTest extends TestCase $context->setHttpsPort($defaultHttpsPort); $urlMatcher->expects($this->any()) ->method('getContext') - ->will($this->returnValue($context)); + ->willReturn($context); $listener = new RouterListener($urlMatcher, $this->requestStack); $event = $this->createRequestEventForUri($uri); @@ -97,7 +97,7 @@ class RouterListenerTest extends TestCase $requestMatcher->expects($this->once()) ->method('matchRequest') ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) - ->will($this->returnValue([])); + ->willReturn([]); $listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext()); $listener->onKernelRequest($event); @@ -113,7 +113,7 @@ class RouterListenerTest extends TestCase $requestMatcher->expects($this->any()) ->method('matchRequest') ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) - ->will($this->returnValue([])); + ->willReturn([]); $context = new RequestContext(); @@ -138,7 +138,7 @@ class RouterListenerTest extends TestCase $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); $requestMatcher->expects($this->once()) ->method('matchRequest') - ->will($this->returnValue($parameter)); + ->willReturn($parameter); $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $logger->expects($this->once()) diff --git a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php index 0eaa63f06a..1f0a6c628b 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php @@ -46,7 +46,7 @@ class TestSessionListenerTest extends TestCase $this->session = $this->getSession(); $this->listener->expects($this->any()) ->method('getSession') - ->will($this->returnValue($this->session)); + ->willReturn($this->session); } public function testShouldSaveMasterRequestSession() @@ -183,28 +183,28 @@ class TestSessionListenerTest extends TestCase { $this->session->expects($this->once()) ->method('isStarted') - ->will($this->returnValue(true)); + ->willReturn(true); } private function sessionHasNotBeenStarted() { $this->session->expects($this->once()) ->method('isStarted') - ->will($this->returnValue(false)); + ->willReturn(false); } private function sessionIsEmpty() { $this->session->expects($this->once()) ->method('isEmpty') - ->will($this->returnValue(true)); + ->willReturn(true); } private function fixSessionId($sessionId) { $this->session->expects($this->any()) ->method('getId') - ->will($this->returnValue($sessionId)); + ->willReturn($sessionId); } private function getSession() @@ -214,7 +214,7 @@ class TestSessionListenerTest extends TestCase ->getMock(); // set return value for getName() - $mock->expects($this->any())->method('getName')->will($this->returnValue('MOCKSESSID')); + $mock->expects($this->any())->method('getName')->willReturn('MOCKSESSID'); return $mock; } diff --git a/vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php index 1627a2b191..9a833ce374 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php @@ -117,6 +117,6 @@ class TranslatorListenerTest extends TestCase $this->requestStack ->expects($this->any()) ->method('getParentRequest') - ->will($this->returnValue($request)); + ->willReturn($request); } } diff --git a/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php b/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php index bc7236f0a8..e2e72df00c 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php @@ -32,7 +32,7 @@ class FragmentHandlerTest extends TestCase $this->requestStack ->expects($this->any()) ->method('getCurrentRequest') - ->will($this->returnValue(Request::create('/'))) + ->willReturn(Request::create('/')) ; } @@ -79,7 +79,7 @@ class FragmentHandlerTest extends TestCase $renderer ->expects($this->any()) ->method('getName') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $e = $renderer ->expects($this->any()) diff --git a/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php index d6f0ff7771..ce71804187 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php @@ -124,18 +124,18 @@ class InlineFragmentRendererTest extends TestCase $controllerResolver ->expects($this->once()) ->method('getController') - ->will($this->returnValue(function () { + ->willReturn(function () { ob_start(); echo 'bar'; throw new \RuntimeException(); - })) + }) ; $argumentResolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface')->getMock(); $argumentResolver ->expects($this->once()) ->method('getArguments') - ->will($this->returnValue([])) + ->willReturn([]) ; $kernel = new HttpKernel(new EventDispatcher(), $controllerResolver, new RequestStack(), $argumentResolver); diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php index 2049a1771a..ef717c63f5 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php @@ -229,7 +229,7 @@ class EsiTest extends TestCase $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock(); $cache->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; if (\is_array($response)) { $cache->expects($this->any()) @@ -239,7 +239,7 @@ class EsiTest extends TestCase } else { $cache->expects($this->any()) ->method('handle') - ->will($this->returnValue($response)) + ->willReturn($response) ; } diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php index 2b9d352c7c..4411427028 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php @@ -196,7 +196,7 @@ class SsiTest extends TestCase $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock(); $cache->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; if (\is_array($response)) { $cache->expects($this->any()) @@ -206,7 +206,7 @@ class SsiTest extends TestCase } else { $cache->expects($this->any()) ->method('handle') - ->will($this->returnValue($response)) + ->willReturn($response) ; } diff --git a/vendor/symfony/http-kernel/Tests/HttpKernelBrowserTest.php b/vendor/symfony/http-kernel/Tests/HttpKernelBrowserTest.php index 4447e951f6..37d471e815 100644 --- a/vendor/symfony/http-kernel/Tests/HttpKernelBrowserTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpKernelBrowserTest.php @@ -156,11 +156,11 @@ class HttpKernelBrowserTest extends TestCase /* should be modified when the getClientSize will be removed */ $file->expects($this->any()) ->method('getSize') - ->will($this->returnValue(INF)) + ->willReturn(INF) ; $file->expects($this->any()) ->method('getClientSize') - ->will($this->returnValue(INF)) + ->willReturn(INF) ; $client->request('POST', '/', [], [$file]); diff --git a/vendor/symfony/http-kernel/Tests/HttpKernelTest.php b/vendor/symfony/http-kernel/Tests/HttpKernelTest.php index d1162f0431..457b525dd2 100644 --- a/vendor/symfony/http-kernel/Tests/HttpKernelTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpKernelTest.php @@ -351,13 +351,13 @@ class HttpKernelTest extends TestCase $controllerResolver ->expects($this->any()) ->method('getController') - ->will($this->returnValue($controller)); + ->willReturn($controller); $argumentResolver = $this->getMockBuilder(ArgumentResolverInterface::class)->getMock(); $argumentResolver ->expects($this->any()) ->method('getArguments') - ->will($this->returnValue($arguments)); + ->willReturn($arguments); return new HttpKernel($eventDispatcher, $controllerResolver, $requestStack, $argumentResolver); } diff --git a/vendor/symfony/http-kernel/Tests/KernelTest.php b/vendor/symfony/http-kernel/Tests/KernelTest.php index 5be4fc8d83..f97074e1cd 100644 --- a/vendor/symfony/http-kernel/Tests/KernelTest.php +++ b/vendor/symfony/http-kernel/Tests/KernelTest.php @@ -123,7 +123,7 @@ class KernelTest extends TestCase $kernel = $this->getKernel(['initializeBundles', 'initializeContainer', 'getBundles']); $kernel->expects($this->once()) ->method('getBundles') - ->will($this->returnValue([$bundle])); + ->willReturn([$bundle]); $kernel->boot(); } @@ -178,7 +178,7 @@ class KernelTest extends TestCase $kernel = $this->getKernel(['getBundles']); $kernel->expects($this->any()) ->method('getBundles') - ->will($this->returnValue([$bundle])); + ->willReturn([$bundle]); $kernel->boot(); $kernel->shutdown(); @@ -201,7 +201,7 @@ class KernelTest extends TestCase $kernel = $this->getKernel(['getHttpKernel']); $kernel->expects($this->once()) ->method('getHttpKernel') - ->will($this->returnValue($httpKernelMock)); + ->willReturn($httpKernelMock); $kernel->handle($request, $type, $catch); } @@ -219,7 +219,7 @@ class KernelTest extends TestCase $kernel = $this->getKernel(['getHttpKernel', 'boot']); $kernel->expects($this->once()) ->method('getHttpKernel') - ->will($this->returnValue($httpKernelMock)); + ->willReturn($httpKernelMock); $kernel->expects($this->once()) ->method('boot'); @@ -381,7 +381,7 @@ EOF; $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'))) + ->willReturn($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')) ; $kernel->locateResource('@Bundle1Bundle/config/routing.xml'); @@ -393,7 +393,7 @@ EOF; $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'))) + ->willReturn($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')) ; $this->assertEquals(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt', $kernel->locateResource('@Bundle1Bundle/foo.txt')); @@ -405,7 +405,7 @@ EOF; $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'))) + ->willReturn($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')) ; $this->assertEquals( @@ -420,7 +420,7 @@ EOF; $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle'))) + ->willReturn($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')) ; $this->assertEquals( @@ -435,7 +435,7 @@ EOF; $kernel ->expects($this->exactly(2)) ->method('getBundle') - ->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle'))) + ->willReturn($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')) ; $this->assertEquals( @@ -451,7 +451,7 @@ EOF; $kernel ->expects($this->exactly(2)) ->method('getBundle') - ->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle'))) + ->willReturn($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')) ; $this->assertEquals( @@ -514,7 +514,7 @@ EOF; $kernel = $this->getKernel(['getHttpKernel']); $kernel->expects($this->exactly(2)) ->method('getHttpKernel') - ->will($this->returnValue($httpKernelMock)); + ->willReturn($httpKernelMock); $kernel->boot(); $kernel->terminate(Request::create('/'), new Response()); @@ -640,19 +640,19 @@ EOF; $bundle ->expects($this->any()) ->method('getName') - ->will($this->returnValue(null === $bundleName ? \get_class($bundle) : $bundleName)) + ->willReturn(null === $bundleName ? \get_class($bundle) : $bundleName) ; $bundle ->expects($this->any()) ->method('getPath') - ->will($this->returnValue($dir)) + ->willReturn($dir) ; $bundle ->expects($this->any()) ->method('getParent') - ->will($this->returnValue($parent)) + ->willReturn($parent) ; return $bundle; @@ -678,7 +678,7 @@ EOF; ; $kernel->expects($this->any()) ->method('registerBundles') - ->will($this->returnValue($bundles)) + ->willReturn($bundles) ; $p = new \ReflectionProperty($kernel, 'rootDir'); $p->setAccessible(true); diff --git a/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php b/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php index 17865203f2..3a5a8ade54 100644 --- a/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php +++ b/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php @@ -149,7 +149,7 @@ class LoggerTest extends TestCase } $dummy->expects($this->atLeastOnce()) ->method('__toString') - ->will($this->returnValue('DUMMY')); + ->willReturn('DUMMY'); $this->logger->warning($dummy); diff --git a/vendor/symfony/mime/MessageConverter.php b/vendor/symfony/mime/MessageConverter.php index 287cbd2f1c..b139f1c086 100644 --- a/vendor/symfony/mime/MessageConverter.php +++ b/vendor/symfony/mime/MessageConverter.php @@ -28,17 +28,12 @@ final class MessageConverter /** * @throws RuntimeException when unable to convert the message to an email */ - public static function toEmail(RawMessage $message): Email + public static function toEmail(Message $message): Email { if ($message instanceof Email) { return $message; } - if (RawMessage::class === \get_class($message)) { - // FIXME: parse the raw message to create the envelope? - throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as it is not supported yet.', RawMessage::class)); - } - // try to convert to a "simple" Email instance $body = $message->getBody(); if ($body instanceof TextPart) { diff --git a/vendor/symfony/service-contracts/composer.json b/vendor/symfony/service-contracts/composer.json index 54341174ce..f4209cc41c 100644 --- a/vendor/symfony/service-contracts/composer.json +++ b/vendor/symfony/service-contracts/composer.json @@ -16,10 +16,10 @@ } ], "require": { - "php": "^7.1.3" + "php": "^7.1.3", + "psr/container": "^1.0" }, "suggest": { - "psr/container": "", "symfony/service-implementation": "" }, "autoload": { diff --git a/vendor/symfony/translation-contracts/TranslatorTrait.php b/vendor/symfony/translation-contracts/TranslatorTrait.php index c1021923c8..488b4f4f23 100644 --- a/vendor/symfony/translation-contracts/TranslatorTrait.php +++ b/vendor/symfony/translation-contracts/TranslatorTrait.php @@ -91,7 +91,7 @@ EOF; } } else { $leftNumber = '-Inf' === $matches['left'] ? -INF : (float) $matches['left']; - $rightNumber = \is_numeric($matches['right']) ? (float) $matches['right'] : INF; + $rightNumber = is_numeric($matches['right']) ? (float) $matches['right'] : INF; if (('[' === $matches['left_delimiter'] ? $number >= $leftNumber : $number > $leftNumber) && (']' === $matches['right_delimiter'] ? $number <= $rightNumber : $number < $rightNumber) @@ -117,7 +117,7 @@ EOF; $message = sprintf('Unable to choose a translation for "%s" with locale "%s" for value "%d". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %%count%% apples").', $id, $locale, $number); - if (\class_exists(InvalidArgumentException::class)) { + if (class_exists(InvalidArgumentException::class)) { throw new InvalidArgumentException($message); } diff --git a/vendor/symfony/translation/Command/XliffLintCommand.php b/vendor/symfony/translation/Command/XliffLintCommand.php index 9bea4d9499..3c2cc9efde 100644 --- a/vendor/symfony/translation/Command/XliffLintCommand.php +++ b/vendor/symfony/translation/Command/XliffLintCommand.php @@ -124,7 +124,9 @@ EOF $normalizedLocale = preg_quote(str_replace('-', '_', $targetLanguage), '/'); // strict file names require translation files to be named '____.locale.xlf' // otherwise, both '____.locale.xlf' and 'locale.____.xlf' are allowed - $expectedFilenamePattern = $this->requireStrictFileNames ? sprintf('/^.*\.%s\.xlf/', $normalizedLocale) : sprintf('/^(.*\.%s\.xlf|%s\..*\.xlf)/', $normalizedLocale, $normalizedLocale); + // also, the regexp matching must be case-insensitive, as defined for 'target-language' values + // http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#target-language + $expectedFilenamePattern = $this->requireStrictFileNames ? sprintf('/^.*\.(?i:%s)\.xlf/', $normalizedLocale) : sprintf('/^(.*\.(?i:%s)\.xlf|(?i:%s)\..*\.xlf)/', $normalizedLocale, $normalizedLocale); if (0 === preg_match($expectedFilenamePattern, basename($file))) { $errors[] = [ diff --git a/vendor/symfony/translation/DataCollector/TranslationDataCollector.php b/vendor/symfony/translation/DataCollector/TranslationDataCollector.php index d99b493ac6..35dfc0e344 100644 --- a/vendor/symfony/translation/DataCollector/TranslationDataCollector.php +++ b/vendor/symfony/translation/DataCollector/TranslationDataCollector.php @@ -36,12 +36,9 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto { $messages = $this->sanitizeCollectedMessages($this->translator->getCollectedMessages()); - $this->data = $this->computeCount($messages); + $this->data += $this->computeCount($messages); $this->data['messages'] = $messages; - $this->data['locale'] = $this->translator->getLocale(); - $this->data['fallback_locales'] = $this->translator->getFallbackLocales(); - $this->data = $this->cloneVar($this->data); } @@ -50,6 +47,8 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto */ public function collect(Request $request, Response $response, \Exception $exception = null) { + $this->data['locale'] = $this->translator->getLocale(); + $this->data['fallback_locales'] = $this->translator->getFallbackLocales(); } /** diff --git a/vendor/symfony/translation/Tests/Command/XliffLintCommandTest.php b/vendor/symfony/translation/Tests/Command/XliffLintCommandTest.php index 516d98af53..df2e2f0951 100644 --- a/vendor/symfony/translation/Tests/Command/XliffLintCommandTest.php +++ b/vendor/symfony/translation/Tests/Command/XliffLintCommandTest.php @@ -94,6 +94,17 @@ class XliffLintCommandTest extends TestCase $this->assertContains('There is a mismatch between the language included in the file name ("messages.en.xlf") and the "es" value used in the "target-language" attribute of the file.', trim($tester->getDisplay())); } + public function testLintTargetLanguageIsCaseInsensitive() + { + $tester = $this->createCommandTester(); + $filename = $this->createFile('note', 'zh-cn', 'messages.zh_CN.xlf'); + + $tester->execute(['filename' => $filename], ['decorated' => false]); + + $this->assertEquals(0, $tester->getStatusCode()); + $this->assertContains('[OK] All 1 XLIFF files contain valid syntax.', trim($tester->getDisplay())); + } + /** * @expectedException \RuntimeException */ diff --git a/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php b/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php index b4d350ef86..bd97a2445c 100644 --- a/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php +++ b/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php @@ -27,7 +27,7 @@ class TranslationDataCollectorTest extends TestCase public function testCollectEmptyMessages() { $translator = $this->getTranslator(); - $translator->expects($this->any())->method('getCollectedMessages')->will($this->returnValue([])); + $translator->expects($this->any())->method('getCollectedMessages')->willReturn([]); $dataCollector = new TranslationDataCollector($translator); $dataCollector->lateCollect(); @@ -125,7 +125,7 @@ class TranslationDataCollectorTest extends TestCase ]; $translator = $this->getTranslator(); - $translator->expects($this->any())->method('getCollectedMessages')->will($this->returnValue($collectedMessages)); + $translator->expects($this->any())->method('getCollectedMessages')->willReturn($collectedMessages); $dataCollector = new TranslationDataCollector($translator); $dataCollector->lateCollect(); diff --git a/vendor/symfony/translation/Tests/MessageCatalogueTest.php b/vendor/symfony/translation/Tests/MessageCatalogueTest.php index 6fe9368f5c..cf0dd1a24c 100644 --- a/vendor/symfony/translation/Tests/MessageCatalogueTest.php +++ b/vendor/symfony/translation/Tests/MessageCatalogueTest.php @@ -103,10 +103,10 @@ class MessageCatalogueTest extends TestCase public function testAddCatalogue() { $r = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r->expects($this->any())->method('__toString')->will($this->returnValue('r')); + $r->expects($this->any())->method('__toString')->willReturn('r'); $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); + $r1->expects($this->any())->method('__toString')->willReturn('r1'); $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo']]); $catalogue->addResource($r); @@ -127,13 +127,13 @@ class MessageCatalogueTest extends TestCase public function testAddFallbackCatalogue() { $r = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r->expects($this->any())->method('__toString')->will($this->returnValue('r')); + $r->expects($this->any())->method('__toString')->willReturn('r'); $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); + $r1->expects($this->any())->method('__toString')->willReturn('r1'); $r2 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r2->expects($this->any())->method('__toString')->will($this->returnValue('r2')); + $r2->expects($this->any())->method('__toString')->willReturn('r2'); $catalogue = new MessageCatalogue('fr_FR', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); $catalogue->addResource($r); @@ -192,11 +192,11 @@ class MessageCatalogueTest extends TestCase { $catalogue = new MessageCatalogue('en'); $r = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r->expects($this->any())->method('__toString')->will($this->returnValue('r')); + $r->expects($this->any())->method('__toString')->willReturn('r'); $catalogue->addResource($r); $catalogue->addResource($r); $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); + $r1->expects($this->any())->method('__toString')->willReturn('r1'); $catalogue->addResource($r1); $this->assertEquals([$r, $r1], $catalogue->getResources()); diff --git a/vendor/symfony/translation/Tests/TranslatorCacheTest.php b/vendor/symfony/translation/Tests/TranslatorCacheTest.php index ec909aaa38..5d437ff76c 100644 --- a/vendor/symfony/translation/Tests/TranslatorCacheTest.php +++ b/vendor/symfony/translation/Tests/TranslatorCacheTest.php @@ -104,7 +104,7 @@ class TranslatorCacheTest extends TestCase $loader ->expects($this->exactly(2)) ->method('load') - ->will($this->returnValue($catalogue)) + ->willReturn($catalogue) ; // 1st pass @@ -249,11 +249,11 @@ class TranslatorCacheTest extends TestCase { $resource = $this->getMockBuilder('Symfony\Component\Config\Resource\SelfCheckingResourceInterface')->getMock(); $loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock(); - $resource->method('isFresh')->will($this->returnValue(false)); + $resource->method('isFresh')->willReturn(false); $loader ->expects($this->exactly(2)) ->method('load') - ->will($this->returnValue($this->getCatalogue('fr', [], [$resource]))); + ->willReturn($this->getCatalogue('fr', [], [$resource])); // prime the cache $translator = new Translator('fr', null, $this->tmpDir, true); |
