Fix and update Composer autoload
This commit is contained in:
committed by
Frédéric Guillot
parent
3e139ab6f4
commit
4cfdb88813
5
vendor/symfony/contracts/CHANGELOG.md
vendored
5
vendor/symfony/contracts/CHANGELOG.md
vendored
@@ -1,11 +1,6 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
1.1.9
|
||||
-----
|
||||
|
||||
* fixed compat with PHP 8
|
||||
|
||||
1.1.0
|
||||
-----
|
||||
|
||||
|
||||
3
vendor/symfony/contracts/Cache/.gitignore
vendored
3
vendor/symfony/contracts/Cache/.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
vendor/
|
||||
composer.lock
|
||||
phpunit.xml
|
||||
12
vendor/symfony/contracts/Cache/CacheTrait.php
vendored
12
vendor/symfony/contracts/Cache/CacheTrait.php
vendored
@@ -15,9 +15,6 @@ use Psr\Cache\CacheItemPoolInterface;
|
||||
use Psr\Cache\InvalidArgumentException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
// Help opcache.preload discover always-needed symbols
|
||||
class_exists(InvalidArgumentException::class);
|
||||
|
||||
/**
|
||||
* An implementation of CacheInterface for PSR-6 CacheItemPoolInterface classes.
|
||||
*
|
||||
@@ -44,21 +41,22 @@ trait CacheTrait
|
||||
private function doGet(CacheItemPoolInterface $pool, string $key, callable $callback, ?float $beta, array &$metadata = null, LoggerInterface $logger = null)
|
||||
{
|
||||
if (0 > $beta = $beta ?? 1.0) {
|
||||
throw new class(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', static::class, $beta)) extends \InvalidArgumentException implements InvalidArgumentException { };
|
||||
throw new class(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', \get_class($this), $beta)) extends \InvalidArgumentException implements InvalidArgumentException {
|
||||
};
|
||||
}
|
||||
|
||||
$item = $pool->getItem($key);
|
||||
$recompute = !$item->isHit() || \INF === $beta;
|
||||
$recompute = !$item->isHit() || INF === $beta;
|
||||
$metadata = $item instanceof ItemInterface ? $item->getMetadata() : [];
|
||||
|
||||
if (!$recompute && $metadata) {
|
||||
$expiry = $metadata[ItemInterface::METADATA_EXPIRY] ?? false;
|
||||
$ctime = $metadata[ItemInterface::METADATA_CTIME] ?? false;
|
||||
|
||||
if ($recompute = $ctime && $expiry && $expiry <= ($now = microtime(true)) - $ctime / 1000 * $beta * log(random_int(1, \PHP_INT_MAX) / \PHP_INT_MAX)) {
|
||||
if ($recompute = $ctime && $expiry && $expiry <= ($now = microtime(true)) - $ctime / 1000 * $beta * log(random_int(1, PHP_INT_MAX) / PHP_INT_MAX)) {
|
||||
// force applying defaultLifetime to expiry
|
||||
$item->expiresAt(null);
|
||||
$logger && $logger->info('Item "{key}" elected for early recomputation {delta}s before its expiration', [
|
||||
$this->logger && $this->logger->info('Item "{key}" elected for early recomputation {delta}s before its expiration', [
|
||||
'key' => $key,
|
||||
'delta' => sprintf('%.1f', $expiry - $now),
|
||||
]);
|
||||
|
||||
@@ -37,11 +37,6 @@ interface ItemInterface extends CacheItemInterface
|
||||
*/
|
||||
const METADATA_TAGS = 'tags';
|
||||
|
||||
/**
|
||||
* Reserved characters that cannot be used in a key or tag.
|
||||
*/
|
||||
const RESERVED_CHARACTERS = '{}()/\@:';
|
||||
|
||||
/**
|
||||
* Adds a tag to a cache item.
|
||||
*
|
||||
|
||||
2
vendor/symfony/contracts/Cache/LICENSE
vendored
2
vendor/symfony/contracts/Cache/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018-2020 Fabien Potencier
|
||||
Copyright (c) 2018-2019 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
8
vendor/symfony/contracts/Cache/composer.json
vendored
8
vendor/symfony/contracts/Cache/composer.json
vendored
@@ -16,10 +16,10 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1.3",
|
||||
"psr/cache": "^1.0"
|
||||
"php": "^7.1.3"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/cache": "",
|
||||
"symfony/cache-implementation": ""
|
||||
},
|
||||
"autoload": {
|
||||
@@ -29,10 +29,6 @@
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
vendor/
|
||||
composer.lock
|
||||
phpunit.xml
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018-2020 Fabien Potencier
|
||||
Copyright (c) 2018-2019 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1.3"
|
||||
"php": "^7.1.3"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/event-dispatcher": "",
|
||||
@@ -29,10 +29,6 @@
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
vendor/
|
||||
composer.lock
|
||||
phpunit.xml
|
||||
@@ -27,7 +27,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
interface ChunkInterface
|
||||
{
|
||||
/**
|
||||
* Tells when the idle timeout has been reached.
|
||||
* Tells when the inactivity timeout has been reached.
|
||||
*
|
||||
* @throws TransportExceptionInterface on a network error
|
||||
*/
|
||||
@@ -36,28 +36,21 @@ interface ChunkInterface
|
||||
/**
|
||||
* Tells when headers just arrived.
|
||||
*
|
||||
* @throws TransportExceptionInterface on a network error or when the idle timeout is reached
|
||||
* @throws TransportExceptionInterface on a network error or when the inactivity timeout is reached
|
||||
*/
|
||||
public function isFirst(): bool;
|
||||
|
||||
/**
|
||||
* Tells when the body just completed.
|
||||
*
|
||||
* @throws TransportExceptionInterface on a network error or when the idle timeout is reached
|
||||
* @throws TransportExceptionInterface on a network error or when the inactivity timeout is reached
|
||||
*/
|
||||
public function isLast(): bool;
|
||||
|
||||
/**
|
||||
* Returns a [status code, headers] tuple when a 1xx status code was just received.
|
||||
*
|
||||
* @throws TransportExceptionInterface on a network error or when the idle timeout is reached
|
||||
*/
|
||||
public function getInformationalStatus(): ?array;
|
||||
|
||||
/**
|
||||
* Returns the content of the response chunk.
|
||||
*
|
||||
* @throws TransportExceptionInterface on a network error or when the idle timeout is reached
|
||||
* @throws TransportExceptionInterface on a network error or when the inactivity timeout is reached
|
||||
*/
|
||||
public function getContent(): string;
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Contracts\HttpClient\Exception;
|
||||
|
||||
/**
|
||||
* When a content-type cannot be decoded to the expected representation.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @experimental in 1.1
|
||||
*/
|
||||
interface DecodingExceptionInterface extends ExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -33,30 +33,26 @@ interface HttpClientInterface
|
||||
'query' => [], // string[] - associative array of query string values to merge with the request's URL
|
||||
'headers' => [], // iterable|string[]|string[][] - headers names provided as keys or as part of values
|
||||
'body' => '', // array|string|resource|\Traversable|\Closure - the callback SHOULD yield a string
|
||||
// smaller than the amount requested as argument; the empty string signals EOF; if
|
||||
// smaller than the amount requested as argument; the empty string signals EOF; when
|
||||
// an array is passed, it is meant as a form payload of field names and values
|
||||
'json' => null, // mixed - if set, implementations MUST set the "body" option to the JSON-encoded
|
||||
// value and set the "content-type" header to a JSON-compatible value if it is not
|
||||
// explicitly defined in the headers option - typically "application/json"
|
||||
'json' => null, // array|\JsonSerializable - when set, implementations MUST set the "body" option to
|
||||
// the JSON-encoded value and set the "content-type" headers to a JSON-compatible
|
||||
// value if they are not defined - typically "application/json"
|
||||
'user_data' => null, // mixed - any extra data to attach to the request (scalar, callable, object...) that
|
||||
// MUST be available via $response->getInfo('user_data') - not used internally
|
||||
'max_redirects' => 20, // int - the maximum number of redirects to follow; a value lower than or equal to 0
|
||||
// means redirects should not be followed; "Authorization" and "Cookie" headers MUST
|
||||
'max_redirects' => 20, // int - the maximum number of redirects to follow; a value lower or equal to 0 means
|
||||
// redirects should not be followed; "Authorization" and "Cookie" headers MUST
|
||||
// NOT follow except for the initial host name
|
||||
'http_version' => null, // string - defaults to the best supported version, typically 1.1 or 2.0
|
||||
'base_uri' => null, // string - the URI to resolve relative URLs, following rules in RFC 3986, section 2
|
||||
'buffer' => true, // bool|resource|\Closure - whether the content of the response should be buffered or not,
|
||||
// or a stream resource where the response body should be written,
|
||||
// or a closure telling if/where the response should be buffered based on its headers
|
||||
'buffer' => true, // bool - whether the content of the response should be buffered or not
|
||||
'on_progress' => null, // callable(int $dlNow, int $dlSize, array $info) - throwing any exceptions MUST abort
|
||||
// the request; it MUST be called on DNS resolution, on arrival of headers and on
|
||||
// completion; it SHOULD be called on upload/download of data and at least 1/s
|
||||
'resolve' => [], // string[] - a map of host to IP address that SHOULD replace DNS resolution
|
||||
'proxy' => null, // string - by default, the proxy-related env vars handled by curl SHOULD be honored
|
||||
'no_proxy' => null, // string - a comma separated list of hosts that do not require a proxy to be reached
|
||||
'timeout' => null, // float - the idle timeout - defaults to ini_get('default_socket_timeout')
|
||||
'max_duration' => 0, // float - the maximum execution time for the request+response as a whole;
|
||||
// a value lower than or equal to 0 means it is unlimited
|
||||
'timeout' => null, // float - the inactivity timeout - defaults to ini_get('default_socket_timeout')
|
||||
'bindto' => '0', // string - the interface or the local socket to bind to
|
||||
'verify_peer' => true, // see https://php.net/context.ssl for the following options
|
||||
'verify_host' => true,
|
||||
@@ -89,7 +85,7 @@ interface HttpClientInterface
|
||||
* Yields responses chunk by chunk as they complete.
|
||||
*
|
||||
* @param ResponseInterface|ResponseInterface[]|iterable $responses One or more responses created by the current HTTP client
|
||||
* @param float|null $timeout The idle timeout before yielding timeout chunks
|
||||
* @param float|null $timeout The inactivity timeout before exiting the iterator
|
||||
*/
|
||||
public function stream($responses, float $timeout = null): ResponseStreamInterface;
|
||||
}
|
||||
|
||||
2
vendor/symfony/contracts/HttpClient/LICENSE
vendored
2
vendor/symfony/contracts/HttpClient/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018-2020 Fabien Potencier
|
||||
Copyright (c) 2018-2019 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace Symfony\Contracts\HttpClient;
|
||||
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
@@ -65,8 +64,7 @@ interface ResponseInterface
|
||||
*
|
||||
* @param bool $throw Whether an exception should be thrown on 3/4/5xx status codes
|
||||
*
|
||||
* @throws DecodingExceptionInterface When the body cannot be decoded to an array
|
||||
* @throws TransportExceptionInterface When a network error occurs
|
||||
* @throws TransportExceptionInterface When the body cannot be decoded or when a network error occurs
|
||||
* @throws RedirectionExceptionInterface On a 3xx when $throw is true and the "max_redirects" option has been reached
|
||||
* @throws ClientExceptionInterface On a 4xx when $throw is true
|
||||
* @throws ServerExceptionInterface On a 5xx when $throw is true
|
||||
@@ -74,9 +72,7 @@ interface ResponseInterface
|
||||
public function toArray(bool $throw = true): array;
|
||||
|
||||
/**
|
||||
* Closes the response stream and all related buffers.
|
||||
*
|
||||
* No further chunk will be yielded after this method has been called.
|
||||
* Cancels the response.
|
||||
*/
|
||||
public function cancel(): void;
|
||||
|
||||
@@ -88,16 +84,15 @@ interface ResponseInterface
|
||||
* another, as the request/response progresses.
|
||||
*
|
||||
* The following info MUST be returned:
|
||||
* - canceled (bool) - true if the response was canceled using ResponseInterface::cancel(), false otherwise
|
||||
* - error (string|null) - the error message when the transfer was aborted, null otherwise
|
||||
* - http_code (int) - the last response code or 0 when it is not known yet
|
||||
* - http_method (string) - the HTTP verb of the last request
|
||||
* - redirect_count (int) - the number of redirects followed while executing the request
|
||||
* - redirect_url (string|null) - the resolved location of redirect responses, null otherwise
|
||||
* - response_headers (array) - an array modelled after the special $http_response_header variable
|
||||
* - start_time (float) - the time when the request was sent or 0.0 when it's pending
|
||||
* - url (string) - the last effective URL of the request
|
||||
* - user_data (mixed|null) - the value of the "user_data" request option, null if not set
|
||||
* - response_headers - an array modelled after the special $http_response_header variable
|
||||
* - redirect_count - the number of redirects followed while executing the request
|
||||
* - redirect_url - the resolved location of redirect responses, null otherwise
|
||||
* - start_time - the time when the request was sent or 0.0 when it's pending
|
||||
* - http_method - the HTTP verb of the last request
|
||||
* - http_code - the last response code or 0 when it is not known yet
|
||||
* - error - the error message when the transfer was aborted, null otherwise
|
||||
* - user_data - the value of the "user_data" request option, null if not set
|
||||
* - url - the last effective URL of the request
|
||||
*
|
||||
* When the "capture_peer_cert_chain" option is true, the "peer_certificate_chain"
|
||||
* attribute SHOULD list the peer certificates as an array of OpenSSL X.509 resources.
|
||||
|
||||
@@ -29,36 +29,18 @@ foreach ($_SERVER as $k => $v) {
|
||||
}
|
||||
}
|
||||
|
||||
$json = json_encode($vars, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
||||
|
||||
switch ($vars['REQUEST_URI']) {
|
||||
default:
|
||||
exit;
|
||||
|
||||
case '/head':
|
||||
header('Content-Length: '.strlen($json), true);
|
||||
break;
|
||||
|
||||
case '/':
|
||||
case '/?a=a&b=b':
|
||||
case 'http://127.0.0.1:8057/':
|
||||
case 'http://localhost:8057/':
|
||||
header('Content-Type: application/json');
|
||||
ob_start('ob_gzhandler');
|
||||
break;
|
||||
|
||||
case '/103':
|
||||
header('HTTP/1.1 103 Early Hints');
|
||||
header('Link: </style.css>; rel=preload; as=style', false);
|
||||
header('Link: </script.js>; rel=preload; as=script', false);
|
||||
flush();
|
||||
usleep(1000);
|
||||
echo "HTTP/1.1 200 OK\r\n";
|
||||
echo "Date: Fri, 26 May 2017 10:02:11 GMT\r\n";
|
||||
echo "Content-Length: 13\r\n";
|
||||
echo "\r\n";
|
||||
echo 'Here the body';
|
||||
exit;
|
||||
|
||||
case '/404':
|
||||
header('Content-Type: application/json', true, 404);
|
||||
break;
|
||||
@@ -87,12 +69,6 @@ switch ($vars['REQUEST_URI']) {
|
||||
header('Location: ..', true, 302);
|
||||
break;
|
||||
|
||||
case '/304':
|
||||
header('Content-Length: 10', true, 304);
|
||||
echo '12345';
|
||||
|
||||
return;
|
||||
|
||||
case '/307':
|
||||
header('Location: http://localhost:8057/post', true, 307);
|
||||
break;
|
||||
@@ -104,7 +80,7 @@ switch ($vars['REQUEST_URI']) {
|
||||
case '/post':
|
||||
$output = json_encode($_POST + ['REQUEST_METHOD' => $vars['REQUEST_METHOD']], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
||||
header('Content-Type: application/json', true);
|
||||
header('Content-Length: '.strlen($output));
|
||||
header('Content-Length: '.\strlen($output));
|
||||
echo $output;
|
||||
exit;
|
||||
|
||||
@@ -145,39 +121,8 @@ switch ($vars['REQUEST_URI']) {
|
||||
header('Content-Encoding: gzip');
|
||||
echo str_repeat('-', 1000);
|
||||
exit;
|
||||
|
||||
case '/max-duration':
|
||||
ignore_user_abort(false);
|
||||
while (true) {
|
||||
echo '<1>';
|
||||
@ob_flush();
|
||||
flush();
|
||||
usleep(500);
|
||||
}
|
||||
exit;
|
||||
|
||||
case '/json':
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode([
|
||||
'documents' => [
|
||||
['id' => '/json/1'],
|
||||
['id' => '/json/2'],
|
||||
['id' => '/json/3'],
|
||||
],
|
||||
]);
|
||||
exit;
|
||||
|
||||
case '/json/1':
|
||||
case '/json/2':
|
||||
case '/json/3':
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode([
|
||||
'title' => $vars['REQUEST_URI'],
|
||||
]);
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Content-Type: application/json', true);
|
||||
|
||||
echo $json;
|
||||
echo json_encode($vars, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
||||
|
||||
@@ -24,7 +24,9 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
*/
|
||||
abstract class HttpClientTestCase extends TestCase
|
||||
{
|
||||
public static function setUpBeforeClass(): void
|
||||
private static $server;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
TestHttpServer::start();
|
||||
}
|
||||
@@ -70,31 +72,6 @@ abstract class HttpClientTestCase extends TestCase
|
||||
$response->getContent();
|
||||
}
|
||||
|
||||
public function testHeadRequest()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$response = $client->request('HEAD', 'http://localhost:8057/head', [
|
||||
'headers' => ['Foo' => 'baR'],
|
||||
'user_data' => $data = new \stdClass(),
|
||||
'buffer' => false,
|
||||
]);
|
||||
|
||||
$this->assertSame([], $response->getInfo('response_headers'));
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
|
||||
$info = $response->getInfo();
|
||||
$this->assertSame('HTTP/1.1 200 OK', $info['response_headers'][0]);
|
||||
$this->assertSame('Host: localhost:8057', $info['response_headers'][1]);
|
||||
|
||||
$headers = $response->getHeaders();
|
||||
|
||||
$this->assertSame('localhost:8057', $headers['host'][0]);
|
||||
$this->assertSame(['application/json'], $headers['content-type']);
|
||||
$this->assertTrue(0 < $headers['content-length'][0]);
|
||||
|
||||
$this->assertSame('', $response->getContent());
|
||||
}
|
||||
|
||||
public function testNonBufferedGetRequest()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
@@ -110,70 +87,6 @@ abstract class HttpClientTestCase extends TestCase
|
||||
$response->getContent();
|
||||
}
|
||||
|
||||
public function testBufferSink()
|
||||
{
|
||||
$sink = fopen('php://temp', 'w+');
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$response = $client->request('GET', 'http://localhost:8057', [
|
||||
'buffer' => $sink,
|
||||
'headers' => ['Foo' => 'baR'],
|
||||
]);
|
||||
|
||||
$body = $response->toArray();
|
||||
$this->assertSame('baR', $body['HTTP_FOO']);
|
||||
|
||||
rewind($sink);
|
||||
$sink = stream_get_contents($sink);
|
||||
$this->assertSame($sink, $response->getContent());
|
||||
}
|
||||
|
||||
public function testConditionalBuffering()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$response = $client->request('GET', 'http://localhost:8057');
|
||||
$firstContent = $response->getContent();
|
||||
$secondContent = $response->getContent();
|
||||
|
||||
$this->assertSame($firstContent, $secondContent);
|
||||
|
||||
$response = $client->request('GET', 'http://localhost:8057', ['buffer' => function () { return false; }]);
|
||||
$response->getContent();
|
||||
|
||||
$this->expectException(TransportExceptionInterface::class);
|
||||
$response->getContent();
|
||||
}
|
||||
|
||||
public function testReentrantBufferCallback()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
|
||||
$response = $client->request('GET', 'http://localhost:8057', ['buffer' => function () use (&$response) {
|
||||
$response->cancel();
|
||||
|
||||
return true;
|
||||
}]);
|
||||
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
|
||||
$this->expectException(TransportExceptionInterface::class);
|
||||
$response->getContent();
|
||||
}
|
||||
|
||||
public function testThrowingBufferCallback()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
|
||||
$response = $client->request('GET', 'http://localhost:8057', ['buffer' => function () {
|
||||
throw new \Exception('Boo.');
|
||||
}]);
|
||||
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
|
||||
$this->expectException(TransportExceptionInterface::class);
|
||||
$this->expectExceptionMessage('Boo');
|
||||
$response->getContent();
|
||||
}
|
||||
|
||||
public function testUnsupportedOption()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
@@ -239,16 +152,6 @@ abstract class HttpClientTestCase extends TestCase
|
||||
$this->assertSame(404, $response->getStatusCode());
|
||||
$this->assertSame(['application/json'], $response->getHeaders(false)['content-type']);
|
||||
$this->assertNotEmpty($response->getContent(false));
|
||||
|
||||
$response = $client->request('GET', 'http://localhost:8057/404');
|
||||
|
||||
try {
|
||||
foreach ($client->stream($response) as $chunk) {
|
||||
$this->assertTrue($chunk->isFirst());
|
||||
}
|
||||
$this->fail(ClientExceptionInterface::class.' expected');
|
||||
} catch (ClientExceptionInterface $e) {
|
||||
}
|
||||
}
|
||||
|
||||
public function testIgnoreErrors()
|
||||
@@ -320,18 +223,6 @@ abstract class HttpClientTestCase extends TestCase
|
||||
$response->getStatusCode();
|
||||
}
|
||||
|
||||
public function test304()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$response = $client->request('GET', 'http://localhost:8057/304', [
|
||||
'headers' => ['If-Match' => '"abc"'],
|
||||
'buffer' => false,
|
||||
]);
|
||||
|
||||
$this->assertSame(304, $response->getStatusCode());
|
||||
$this->assertSame('', $response->getContent(false));
|
||||
}
|
||||
|
||||
public function testRedirects()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
@@ -555,7 +446,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
|
||||
$body = $response->toArray();
|
||||
|
||||
$this->assertStringContainsString('json', $body['content-type']);
|
||||
$this->assertContains('json', $body['content-type']);
|
||||
unset($body['content-type']);
|
||||
$this->assertSame(['foo' => 'bar', 'REQUEST_METHOD' => 'POST'], $body);
|
||||
}
|
||||
@@ -614,39 +505,13 @@ abstract class HttpClientTestCase extends TestCase
|
||||
$response->getHeaders();
|
||||
}
|
||||
|
||||
public function testInfoOnCanceledResponse()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
|
||||
$response = $client->request('GET', 'http://localhost:8057/timeout-header');
|
||||
|
||||
$this->assertFalse($response->getInfo('canceled'));
|
||||
$response->cancel();
|
||||
$this->assertTrue($response->getInfo('canceled'));
|
||||
}
|
||||
|
||||
public function testCancelInStream()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$response = $client->request('GET', 'http://localhost:8057/404');
|
||||
|
||||
foreach ($client->stream($response) as $chunk) {
|
||||
$response->cancel();
|
||||
}
|
||||
|
||||
$this->expectException(TransportExceptionInterface::class);
|
||||
|
||||
foreach ($client->stream($response) as $chunk) {
|
||||
}
|
||||
}
|
||||
|
||||
public function testOnProgressCancel()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$response = $client->request('GET', 'http://localhost:8057/timeout-body', [
|
||||
'on_progress' => function ($dlNow) {
|
||||
if (0 < $dlNow) {
|
||||
throw new \Exception('Aborting the request.');
|
||||
throw new \Exception('Aborting the request');
|
||||
}
|
||||
},
|
||||
]);
|
||||
@@ -656,7 +521,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
}
|
||||
$this->fail(ClientExceptionInterface::class.' expected');
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
$this->assertSame('Aborting the request.', $e->getPrevious()->getMessage());
|
||||
$this->assertSame('Aborting the request', $e->getPrevious()->getMessage());
|
||||
}
|
||||
|
||||
$this->assertNotNull($response->getInfo('error'));
|
||||
@@ -670,7 +535,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
$response = $client->request('GET', 'http://localhost:8057/timeout-body', [
|
||||
'on_progress' => function ($dlNow) {
|
||||
if (0 < $dlNow) {
|
||||
throw new \Error('BUG.');
|
||||
throw new \Error('BUG');
|
||||
}
|
||||
},
|
||||
]);
|
||||
@@ -680,7 +545,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
}
|
||||
$this->fail('Error expected');
|
||||
} catch (\Error $e) {
|
||||
$this->assertSame('BUG.', $e->getMessage());
|
||||
$this->assertSame('BUG', $e->getMessage());
|
||||
}
|
||||
|
||||
$this->assertNotNull($response->getInfo('error'));
|
||||
@@ -700,34 +565,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
|
||||
$response = null;
|
||||
$this->expectException(TransportExceptionInterface::class);
|
||||
$client->request('GET', 'http://symfony.com:8057/', ['timeout' => 1]);
|
||||
}
|
||||
|
||||
public function testIdnResolve()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
|
||||
$response = $client->request('GET', 'http://0-------------------------------------------------------------0.com:8057/', [
|
||||
'resolve' => ['0-------------------------------------------------------------0.com' => '127.0.0.1'],
|
||||
]);
|
||||
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
|
||||
$response = $client->request('GET', 'http://Bücher.example:8057/', [
|
||||
'resolve' => ['xn--bcher-kva.example' => '127.0.0.1'],
|
||||
]);
|
||||
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
}
|
||||
|
||||
public function testNotATimeout()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$response = $client->request('GET', 'http://localhost:8057/timeout-header', [
|
||||
'timeout' => 0.9,
|
||||
]);
|
||||
sleep(1);
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
$client->request('GET', 'http://symfony.com:8057/', ['timeout' => 3]);
|
||||
}
|
||||
|
||||
public function testTimeoutOnAccess()
|
||||
@@ -786,53 +624,18 @@ abstract class HttpClientTestCase extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testTimeoutWithActiveConcurrentStream()
|
||||
{
|
||||
$p1 = TestHttpServer::start(8067);
|
||||
$p2 = TestHttpServer::start(8077);
|
||||
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$streamingResponse = $client->request('GET', 'http://localhost:8067/max-duration');
|
||||
$blockingResponse = $client->request('GET', 'http://localhost:8077/timeout-body', [
|
||||
'timeout' => 0.25,
|
||||
]);
|
||||
|
||||
$this->assertSame(200, $streamingResponse->getStatusCode());
|
||||
$this->assertSame(200, $blockingResponse->getStatusCode());
|
||||
|
||||
$this->expectException(TransportExceptionInterface::class);
|
||||
|
||||
try {
|
||||
$blockingResponse->getContent();
|
||||
} finally {
|
||||
$p1->stop();
|
||||
$p2->stop();
|
||||
}
|
||||
}
|
||||
|
||||
public function testDestruct()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
|
||||
$downloaded = 0;
|
||||
$start = microtime(true);
|
||||
$client->request('GET', 'http://localhost:8057/timeout-long');
|
||||
$client = null;
|
||||
$duration = microtime(true) - $start;
|
||||
|
||||
$this->assertGreaterThan(1, $duration);
|
||||
$this->assertLessThan(4, $duration);
|
||||
}
|
||||
|
||||
public function testGetContentAfterDestruct()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
|
||||
try {
|
||||
$client->request('GET', 'http://localhost:8057/404');
|
||||
$this->fail(ClientExceptionInterface::class.' expected');
|
||||
} catch (ClientExceptionInterface $e) {
|
||||
$this->assertSame('GET', $e->getResponse()->toArray(false)['REQUEST_METHOD']);
|
||||
}
|
||||
$this->assertLessThan(3, $duration);
|
||||
}
|
||||
|
||||
public function testProxy()
|
||||
@@ -844,7 +647,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
|
||||
$body = $response->toArray();
|
||||
$this->assertSame('localhost:8057', $body['HTTP_HOST']);
|
||||
$this->assertMatchesRegularExpression('#^http://(localhost|127\.0\.0\.1):8057/$#', $body['REQUEST_URI']);
|
||||
$this->assertRegexp('#^http://(localhost|127\.0\.0\.1):8057/$#', $body['REQUEST_URI']);
|
||||
|
||||
$response = $client->request('GET', 'http://localhost:8057/', [
|
||||
'proxy' => 'http://foo:b%3Dar@localhost:8057',
|
||||
@@ -888,11 +691,11 @@ abstract class HttpClientTestCase extends TestCase
|
||||
$headers = $response->getHeaders();
|
||||
|
||||
$this->assertSame(['Accept-Encoding'], $headers['vary']);
|
||||
$this->assertStringContainsString('gzip', $headers['content-encoding'][0]);
|
||||
$this->assertContains('gzip', $headers['content-encoding'][0]);
|
||||
|
||||
$body = $response->toArray();
|
||||
|
||||
$this->assertStringContainsString('gzip', $body['HTTP_ACCEPT_ENCODING']);
|
||||
$this->assertContains('gzip', $body['HTTP_ACCEPT_ENCODING']);
|
||||
}
|
||||
|
||||
public function testBaseUri()
|
||||
@@ -918,36 +721,6 @@ abstract class HttpClientTestCase extends TestCase
|
||||
$this->assertSame('/?a=a&b=b', $body['REQUEST_URI']);
|
||||
}
|
||||
|
||||
public function testInformationalResponse()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$response = $client->request('GET', 'http://localhost:8057/103');
|
||||
|
||||
$this->assertSame('Here the body', $response->getContent());
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
}
|
||||
|
||||
public function testInformationalResponseStream()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$response = $client->request('GET', 'http://localhost:8057/103');
|
||||
|
||||
$chunks = [];
|
||||
foreach ($client->stream($response) as $chunk) {
|
||||
$chunks[] = $chunk;
|
||||
}
|
||||
|
||||
$this->assertSame(103, $chunks[0]->getInformationalStatus()[0]);
|
||||
$this->assertSame(['</style.css>; rel=preload; as=style', '</script.js>; rel=preload; as=script'], $chunks[0]->getInformationalStatus()[1]['link']);
|
||||
$this->assertTrue($chunks[1]->isFirst());
|
||||
$this->assertSame('Here the body', $chunks[2]->getContent());
|
||||
$this->assertTrue($chunks[3]->isLast());
|
||||
$this->assertNull($chunks[3]->getInformationalStatus());
|
||||
|
||||
$this->assertSame(['date', 'content-length'], array_keys($response->getHeaders()));
|
||||
$this->assertContains('Link: </style.css>; rel=preload; as=style', $response->getInfo('response_headers'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension zlib
|
||||
*/
|
||||
@@ -961,7 +734,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
$headers = $response->getHeaders();
|
||||
|
||||
$this->assertSame(['Accept-Encoding'], $headers['vary']);
|
||||
$this->assertStringContainsString('gzip', $headers['content-encoding'][0]);
|
||||
$this->assertContains('gzip', $headers['content-encoding'][0]);
|
||||
|
||||
$body = $response->getContent();
|
||||
$this->assertSame("\x1F", $body[0]);
|
||||
@@ -981,24 +754,4 @@ abstract class HttpClientTestCase extends TestCase
|
||||
$this->expectException(TransportExceptionInterface::class);
|
||||
$response->getContent();
|
||||
}
|
||||
|
||||
public function testMaxDuration()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$response = $client->request('GET', 'http://localhost:8057/max-duration', [
|
||||
'max_duration' => 0.1,
|
||||
]);
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
try {
|
||||
$response->getContent();
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
$duration = microtime(true) - $start;
|
||||
|
||||
$this->assertLessThan(10, $duration);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,28 +19,31 @@ use Symfony\Component\Process\Process;
|
||||
*/
|
||||
class TestHttpServer
|
||||
{
|
||||
private static $process = [];
|
||||
private static $server;
|
||||
|
||||
public static function start(int $port = 8057)
|
||||
public static function start()
|
||||
{
|
||||
if (isset(self::$process[$port])) {
|
||||
self::$process[$port]->stop();
|
||||
} else {
|
||||
register_shutdown_function(static function () use ($port) {
|
||||
self::$process[$port]->stop();
|
||||
});
|
||||
if (null !== self::$server) {
|
||||
return;
|
||||
}
|
||||
|
||||
$finder = new PhpExecutableFinder();
|
||||
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:'.$port]));
|
||||
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:8057']));
|
||||
$process->setWorkingDirectory(__DIR__.'/Fixtures/web');
|
||||
$process->setTimeout(300);
|
||||
$process->start();
|
||||
self::$process[$port] = $process;
|
||||
|
||||
do {
|
||||
usleep(50000);
|
||||
} while (!@fopen('http://127.0.0.1:'.$port, 'r'));
|
||||
self::$server = new class() {
|
||||
public $process;
|
||||
|
||||
return $process;
|
||||
public function __destruct()
|
||||
{
|
||||
$this->process->stop();
|
||||
}
|
||||
};
|
||||
|
||||
self::$server->process = $process;
|
||||
|
||||
sleep('\\' === \DIRECTORY_SEPARATOR ? 10 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1.3"
|
||||
"php": "^7.1.3"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/http-client-implementation": ""
|
||||
@@ -28,10 +28,6 @@
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/symfony/contracts/LICENSE
vendored
2
vendor/symfony/contracts/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018-2020 Fabien Potencier
|
||||
Copyright (c) 2018-2019 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
3
vendor/symfony/contracts/Service/.gitignore
vendored
3
vendor/symfony/contracts/Service/.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
vendor/
|
||||
composer.lock
|
||||
phpunit.xml
|
||||
2
vendor/symfony/contracts/Service/LICENSE
vendored
2
vendor/symfony/contracts/Service/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018-2020 Fabien Potencier
|
||||
Copyright (c) 2018-2019 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -14,10 +14,6 @@ namespace Symfony\Contracts\Service;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
// Help opcache.preload discover always-needed symbols
|
||||
class_exists(ContainerExceptionInterface::class);
|
||||
class_exists(NotFoundExceptionInterface::class);
|
||||
|
||||
/**
|
||||
* A trait to help implement ServiceProviderInterface.
|
||||
*
|
||||
@@ -40,8 +36,6 @@ trait ServiceLocatorTrait
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has($id)
|
||||
{
|
||||
@@ -87,7 +81,7 @@ trait ServiceLocatorTrait
|
||||
} else {
|
||||
$type = (new \ReflectionFunction($factory))->getReturnType();
|
||||
|
||||
$this->providedTypes[$name] = $type ? ($type->allowsNull() ? '?' : '').($type instanceof \ReflectionNamedType ? $type->getName() : $type) : '?';
|
||||
$this->providedTypes[$name] = $type ? ($type->allowsNull() ? '?' : '').$type->getName() : '?';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ use Psr\Container\ContainerInterface;
|
||||
trait ServiceSubscriberTrait
|
||||
{
|
||||
/** @var ContainerInterface */
|
||||
protected $container;
|
||||
private $container;
|
||||
|
||||
public static function getSubscribedServices(): array
|
||||
{
|
||||
@@ -40,7 +40,7 @@ trait ServiceSubscriberTrait
|
||||
}
|
||||
|
||||
if (self::class === $method->getDeclaringClass()->name && ($returnType = $method->getReturnType()) && !$returnType->isBuiltin()) {
|
||||
$services[self::class.'::'.$method->name] = '?'.($returnType instanceof \ReflectionNamedType ? $returnType->getName() : $type);
|
||||
$services[self::class.'::'.$method->name] = '?'.$returnType->getName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,5 @@ trait ServiceSubscriberTrait
|
||||
if (\is_callable(['parent', __FUNCTION__])) {
|
||||
return parent::setContainer($container);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ use PHPUnit\Framework\TestCase;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Contracts\Service\ServiceLocatorTrait;
|
||||
|
||||
abstract class ServiceLocatorTest extends TestCase
|
||||
class ServiceLocatorTest extends TestCase
|
||||
{
|
||||
protected function getServiceLocator(array $factories)
|
||||
public function getServiceLocator(array $factories)
|
||||
{
|
||||
return new class($factories) implements ContainerInterface {
|
||||
use ServiceLocatorTrait;
|
||||
@@ -64,12 +64,12 @@ abstract class ServiceLocatorTest extends TestCase
|
||||
$this->assertSame(2, $i);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psr\Container\NotFoundExceptionInterface
|
||||
* @expectedExceptionMessage The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.
|
||||
*/
|
||||
public function testThrowsOnUndefinedInternalService()
|
||||
{
|
||||
if (!$this->getExpectedException()) {
|
||||
$this->expectException('Psr\Container\NotFoundExceptionInterface');
|
||||
$this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.');
|
||||
}
|
||||
$locator = $this->getServiceLocator([
|
||||
'foo' => function () use (&$locator) { return $locator->get('bar'); },
|
||||
]);
|
||||
@@ -77,10 +77,12 @@ abstract class ServiceLocatorTest extends TestCase
|
||||
$locator->get('foo');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psr\Container\ContainerExceptionInterface
|
||||
* @expectedExceptionMessage Circular reference detected for service "bar", path: "bar -> baz -> bar".
|
||||
*/
|
||||
public function testThrowsOnCircularReference()
|
||||
{
|
||||
$this->expectException('Psr\Container\ContainerExceptionInterface');
|
||||
$this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> baz -> bar".');
|
||||
$locator = $this->getServiceLocator([
|
||||
'foo' => function () use (&$locator) { return $locator->get('bar'); },
|
||||
'bar' => function () use (&$locator) { return $locator->get('baz'); },
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1.3",
|
||||
"psr/container": "^1.0"
|
||||
"php": "^7.1.3"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/container": "",
|
||||
"symfony/service-implementation": ""
|
||||
},
|
||||
"autoload": {
|
||||
@@ -29,10 +29,6 @@
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ class CacheTraitTest extends TestCase
|
||||
return 'computed data';
|
||||
};
|
||||
|
||||
$cache->get('key', $callback, \INF);
|
||||
$cache->get('key', $callback, INF);
|
||||
}
|
||||
|
||||
public function testExceptionOnNegativeBeta()
|
||||
@@ -127,39 +127,39 @@ class TestPool implements CacheItemPoolInterface
|
||||
{
|
||||
use CacheTrait;
|
||||
|
||||
public function hasItem($key): bool
|
||||
public function hasItem($key)
|
||||
{
|
||||
}
|
||||
|
||||
public function deleteItem($key): bool
|
||||
public function deleteItem($key)
|
||||
{
|
||||
}
|
||||
|
||||
public function deleteItems(array $keys = []): bool
|
||||
public function deleteItems(array $keys = [])
|
||||
{
|
||||
}
|
||||
|
||||
public function getItem($key): CacheItemInterface
|
||||
public function getItem($key)
|
||||
{
|
||||
}
|
||||
|
||||
public function getItems(array $key = []): iterable
|
||||
public function getItems(array $key = [])
|
||||
{
|
||||
}
|
||||
|
||||
public function saveDeferred(CacheItemInterface $item): bool
|
||||
public function saveDeferred(CacheItemInterface $item)
|
||||
{
|
||||
}
|
||||
|
||||
public function save(CacheItemInterface $item): bool
|
||||
public function save(CacheItemInterface $item)
|
||||
{
|
||||
}
|
||||
|
||||
public function commit(): bool
|
||||
public function commit()
|
||||
{
|
||||
}
|
||||
|
||||
public function clear(): bool
|
||||
public function clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
vendor/
|
||||
composer.lock
|
||||
phpunit.xml
|
||||
2
vendor/symfony/contracts/Translation/LICENSE
vendored
2
vendor/symfony/contracts/Translation/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018-2020 Fabien Potencier
|
||||
Copyright (c) 2018-2019 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -158,10 +158,10 @@ class TranslatorTest extends TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider getNonMatchingMessages
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testThrowExceptionIfMatchingMessageCannotBeFound($id, $number)
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$translator = $this->getTranslator();
|
||||
|
||||
$translator->trans($id, ['%count%' => $number]);
|
||||
|
||||
@@ -43,9 +43,7 @@ trait TranslatorTrait
|
||||
*/
|
||||
public function trans($id, array $parameters = [], $domain = null, $locale = null)
|
||||
{
|
||||
if ('' === $id = (string) $id) {
|
||||
return '';
|
||||
}
|
||||
$id = (string) $id;
|
||||
|
||||
if (!isset($parameters['%count%']) || !is_numeric($parameters['%count%'])) {
|
||||
return strtr($id, $parameters);
|
||||
@@ -92,8 +90,8 @@ EOF;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$leftNumber = '-Inf' === $matches['left'] ? -\INF : (float) $matches['left'];
|
||||
$rightNumber = is_numeric($matches['right']) ? (float) $matches['right'] : \INF;
|
||||
$leftNumber = '-Inf' === $matches['left'] ? -INF : (float) $matches['left'];
|
||||
$rightNumber = \is_numeric($matches['right']) ? (float) $matches['right'] : INF;
|
||||
|
||||
if (('[' === $matches['left_delimiter'] ? $number >= $leftNumber : $number > $leftNumber)
|
||||
&& (']' === $matches['right_delimiter'] ? $number <= $rightNumber : $number < $rightNumber)
|
||||
@@ -119,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1.3"
|
||||
"php": "^7.1.3"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/translation-implementation": ""
|
||||
@@ -28,10 +28,6 @@
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
8
vendor/symfony/contracts/composer.json
vendored
8
vendor/symfony/contracts/composer.json
vendored
@@ -16,11 +16,11 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1.3",
|
||||
"psr/cache": "^1.0",
|
||||
"psr/container": "^1.0"
|
||||
"php": "^7.1.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/cache": "^1.0",
|
||||
"psr/container": "^1.0",
|
||||
"symfony/polyfill-intl-idn": "^1.10"
|
||||
},
|
||||
"replace": {
|
||||
@@ -31,6 +31,8 @@
|
||||
"symfony/translation-contracts": "self.version"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/cache": "When using the Cache contracts",
|
||||
"psr/container": "When using the Service contracts",
|
||||
"psr/event-dispatcher": "When using the EventDispatcher contracts",
|
||||
"symfony/cache-implementation": "",
|
||||
"symfony/event-dispatcher-implementation": "",
|
||||
|
||||
8
vendor/symfony/finder/Finder.php
vendored
8
vendor/symfony/finder/Finder.php
vendored
@@ -38,9 +38,9 @@ use Symfony\Component\Finder\Iterator\SortableIterator;
|
||||
*/
|
||||
class Finder implements \IteratorAggregate, \Countable
|
||||
{
|
||||
const IGNORE_VCS_FILES = 1;
|
||||
const IGNORE_DOT_FILES = 2;
|
||||
const IGNORE_VCS_IGNORED_FILES = 4;
|
||||
public const IGNORE_VCS_FILES = 1;
|
||||
public const IGNORE_DOT_FILES = 2;
|
||||
public const IGNORE_VCS_IGNORED_FILES = 4;
|
||||
|
||||
private $mode = 0;
|
||||
private $names = [];
|
||||
@@ -655,7 +655,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the any results were found.
|
||||
* Check if any results were found.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace Symfony\Component\Finder\Iterator;
|
||||
*/
|
||||
class FileTypeFilterIterator extends \FilterIterator
|
||||
{
|
||||
const ONLY_FILES = 1;
|
||||
const ONLY_DIRECTORIES = 2;
|
||||
public const ONLY_FILES = 1;
|
||||
public const ONLY_DIRECTORIES = 2;
|
||||
|
||||
private $mode;
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@ namespace Symfony\Component\Finder\Iterator;
|
||||
*/
|
||||
class SortableIterator implements \IteratorAggregate
|
||||
{
|
||||
const SORT_BY_NONE = 0;
|
||||
const SORT_BY_NAME = 1;
|
||||
const SORT_BY_TYPE = 2;
|
||||
const SORT_BY_ACCESSED_TIME = 3;
|
||||
const SORT_BY_CHANGED_TIME = 4;
|
||||
const SORT_BY_MODIFIED_TIME = 5;
|
||||
const SORT_BY_NAME_NATURAL = 6;
|
||||
public const SORT_BY_NONE = 0;
|
||||
public const SORT_BY_NAME = 1;
|
||||
public const SORT_BY_TYPE = 2;
|
||||
public const SORT_BY_ACCESSED_TIME = 3;
|
||||
public const SORT_BY_CHANGED_TIME = 4;
|
||||
public const SORT_BY_MODIFIED_TIME = 5;
|
||||
public const SORT_BY_NAME_NATURAL = 6;
|
||||
|
||||
private $iterator;
|
||||
private $sort;
|
||||
|
||||
7
vendor/symfony/finder/composer.json
vendored
7
vendor/symfony/finder/composer.json
vendored
@@ -24,10 +24,5 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "5.1-dev"
|
||||
}
|
||||
}
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user