Commit Graph

251 Commits

Author SHA1 Message Date
Nicolas Grekas
b4e2ba2c04 fix merge 2019-09-20 12:11:58 +02:00
Nicolas Grekas
bbf2ae576e Merge branch '4.3' into 4.4
* 4.3:
  [HttpKernel] fix merge
  fix tests
  [HttpClient] fix throwing HTTP exceptions when the 1st chunk is emitted
2019-09-20 11:28:18 +02:00
Nicolas Grekas
3c93764f10 [HttpClient] fix throwing HTTP exceptions when the 1st chunk is emitted 2019-09-19 20:56:12 +02:00
Fabien Potencier
3c78fde548 Merge branch '4.3' into 4.4
* 4.3:
  [Twig] Remove dead code
  Add gitignore file for Symfony 4.3
  Add gitignore file for Symfony 3.4
  [Inflector] Add .gitignore file
  [Messenger] Fix exception message of failed message is dropped on retry
  Add default value for Accept header
  [HttpClient] Add .gitignore file
  [Finder] Adjust regex to correctly match comments in gitignore contents
  [Security] Removed unused argument in Test
  [Console] Get dimensions from stty on windows if possible
  [Inflector] add support 'see' to 'ee' for singularize 'fees' to 'fee'
2019-09-17 13:12:18 +02:00
Valentine Boineau
856b9a8a6e Add gitignore file for Symfony 4.3 2019-09-17 11:54:03 +02:00
Nicolas Grekas
789448b65c Merge branch '4.3' into 4.4
* 4.3:
  Re-enable push support for HttpClient
  [DependencyInjection] Accept existing interfaces as valid named args
  Fixed incompatibility between ServiceSubscriberTrait and classes with protected $container property
2019-09-11 10:38:59 +02:00
Zmey
954dad44a1 Fixed incompatibility between ServiceSubscriberTrait and classes with protected $container property 2019-09-11 07:03:51 +02:00
andyexeter
d8533066de [Cache] Added reserved characters constant for CacheItem 2019-09-11 06:59:27 +02:00
Nicolas Grekas
b0abc10617 Merge branch '4.3' into 4.4
* 4.3:
  [HttpClient] Fix a bug preventing Server Pushes to be handled properly
  [HttpClient] fix support for 103 Early Hints and other informational status codes
  [DI] fix failure
  [Validator] Add ConstraintValidator::formatValue() tests
  [HttpClient] improve handling of HTTP/2 PUSH
  Fix #33427
  [Validator] Only handle numeric values in DivisibleBy
  [Validator] Sync string to date behavior and throw a better exception
  Check phpunit configuration for listeners
  [DI] fix support for "!tagged_locator foo"
2019-09-03 23:44:11 +02:00
Nicolas Grekas
34275bba1c [HttpClient] fix support for 103 Early Hints and other informational status codes 2019-09-03 23:21:26 +02:00
Yonel Ceruto
55eac639c5 Nullable message id? 2019-09-03 08:18:35 -04:00
Nicolas Grekas
fc186bb78f Add return types to tests and final|internal|private methods 2019-08-21 17:14:41 +02:00
Nicolas Grekas
225bf41e3b Merge branch '4.3' into 4.4
* 4.3:
  cs fix
  Fix inconsistent return points.
  [Config] Add handling for ignored keys in ArrayNode::mergeValues.
  Fix inconsistent return points.
  [Security/Core] UserInterface::getPassword() can return null
  [Router] Fix TraceableUrlMatcher behaviour with trailing slash
  Revert "bug #33092 [DependencyInjection] Improve an exception message (fabpot)"
2019-08-20 16:44:19 +02:00
Alexander M. Turek
c26c53596e Fix inconsistent return points. 2019-08-20 16:27:59 +02:00
Nicolas Grekas
aa338c8b42 Import return annotations from vendors 2019-08-14 15:27:41 +02:00
Nicolas Grekas
11fab74e5c Merge branch '4.3' into 4.4
* 4.3:
  Fix compatibility with PHPUnit 8
2019-08-08 12:05:21 +02:00
Jérémy Derussé
55daf15353
Fix compatibility with PHPUnit 8 2019-08-08 12:03:27 +02:00
Nicolas Grekas
2273de0011 Merge branch '4.3' into 4.4
* 4.3:
  consistently throw NotSupportException
  [HttpKernel] Clarify error handler restoring process again
  [HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt
  [Intl] fix nullable phpdocs and useless method visibility of internal class
  Resilience against file_get_contents() race conditions.
2019-08-08 11:18:35 +02:00
Grégoire Pineau
e289723aad [HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt 2019-08-08 08:37:38 +02:00
Nicolas Grekas
a0c2aa8302 Merge branch '4.3' into 4.4
* 4.3:
  Fix inconsistent return points.
  pass translation parameters to the trans filter
  [Mime] fixed wrong mimetype
  [ProxyManagerBridge] Polyfill for unmaintained version
  [HttpClient] Declare `$active` first to prevent weird issue
  Remove deprecated assertContains
  [HttpClient] fix tests
  SCA: dropped unused mocks, duplicate import and a function alias usage
  Added correct plural for box -> boxes
  [Config] fix test
  Fix remaining tests
  Improve fa (persian) translation
2019-08-07 14:00:28 +02:00
Mario Blažek
43acda6cf4 Remove deprecated assertContains 2019-08-07 10:22:11 +02:00
Thomas Calvet
3cbb978b00 [HttpClient] Relax max duration test assertion 2019-08-06 14:14:26 +02:00
Nicolas Grekas
3498259b12 feature #32807 [HttpClient] add "max_duration" option (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] add "max_duration" option

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/32765
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/12073

Commits
-------

a4178f1369 [HttpClient] add "max_duration" option
2019-08-06 10:45:25 +02:00
Thomas Calvet
356341bc19 [HttpClient] Minor fixes 2019-08-05 15:12:03 +02:00
Thomas Calvet
a4178f1369 [HttpClient] add "max_duration" option 2019-08-05 12:08:40 +02:00
Nicolas Grekas
d2c4bf0da8 [HttpClient] use "idle" instead of "inactivity" when telling about the timeout option 2019-08-04 17:49:22 +02:00
Nicolas Grekas
1b56d7f04d Merge branch '3.4' into 4.3
* 3.4:
  Fix tests
  Fix deprecated phpunit annotation
2019-08-02 14:15:04 +02:00
Nicolas Grekas
9ac85d5d8b [HttpClient] Preserve the case of headers when sending them 2019-07-31 13:44:32 +02:00
Nicolas Grekas
5db58f6d37 Merge branch '4.3' into 4.4
* 4.3:
  [Security/Core] align defaults for sodium with PHP 7.4
  fix inline handling when dumping tagged values
  [HttpClient] fix canceling responses in a streaming loop
  [Messenger] Flatten collection of stamps collected by the traceable middleware
  [PropertyAccess] Fix PropertyAccessorCollectionTest
  [HttpClient] rewind stream when using Psr18Client
  Typo in web profiler
  [4.3] Remove dead test fixtures
  [Routing] Fix CHANGELOG
  relax some date parser patterns
  Avoid getting right to left style
2019-07-24 16:49:41 +02:00
Nicolas Grekas
c5c67d913d [HttpClient] fix canceling responses in a streaming loop 2019-07-24 09:56:35 +02:00
Nicolas Grekas
55c0b02587 Merge branch '4.3' into 4.4
* 4.3: (34 commits)
  [PhpunitBridge] Read environment variable from superglobals
  [Bridge/PhpUnit] Fix PHP5.5 compat
  [PhpUnitBridge] More accurate grouping
  fixed CS
  Extract unrecoverable exception to interface
  [FrameworkBundle] Fix calling Client::getProfile() before sending a request
  Fix type error
  [Security/Core] require libsodium >= 1.0.14
  [Workflow] re-add workflow.definition tag to workflow services
  [Security/Core] Don't use ParagonIE_Sodium_Compat
  revert #30525 due to performance penalty
  collect called listeners information only once
  [Lock] fix missing inherit docs in RedisStore
  [Messenger] fix retrying handlers using DoctrineTransactionMiddleware
  [Mailgun Mailer] fixed issue when using html body
  [HttpClient] fix timing measurements with NativeHttpClient
  [HttpClient] fix dealing with 1xx informational responses
  add test to avoid regressions
  fix mirroring directory into parent directory
  fix typos
  ...
2019-06-26 11:30:56 +02:00
Nicolas Grekas
412411d795 [HttpClient] fix dealing with 1xx informational responses 2019-06-23 19:42:15 +02:00
Nicolas Grekas
8a1813a095 Revert "minor #32054 Prepare for PHP 7.4 preload (nicolas-grekas)"
This reverts commit a0aa94114a, reversing
changes made to 8496003634.
2019-06-20 08:42:33 +02:00
Nicolas Grekas
651de173df Merge branch '4.3' into 4.4
* 4.3:
  [Cache] replace getNsSeparator by NS_SEPARATOR on AbstractTrait
  [Cache] fix versioning with SimpleCacheAdapter
  [Messenger] fix AMQP delay queue to be per exchange
  Fix expired lock not cleaned
  [HttpClient] throw DecodingExceptionInterface when toArray() fails because of content-type error
  [HttpFoundation] Fix SA/phpdoc JsonResponse
  [DI] Show the right class autowired when providing a non-existing class in constructor
  SimpleCacheAdapter fails to cache any item if a namespace is used
  validate composite constraints in all groups
  [Serializer] Handle true and false appropriately in CSV encoder
  [Messenger] improve logs
  [Messenger] fix delay delivery for non-fanout exchanges
  Parameterize Mailgun's region
  Fix binary operation `+`, `-` or `*` on string
  [VarDumper] fix dumping objects that implement __debugInfo()
  [HttpClient] Don't use CurlHttpClient on Windows when curl.cainfo is not set
  Add statement to fileLink to ignore href code when no fileLink.
  [Routing] fix absolute url generation when scheme is not known
2019-06-17 19:38:10 +02:00
Nicolas Grekas
3f167417fb [HttpClient] throw DecodingExceptionInterface when toArray() fails because of content-type error 2019-06-16 20:17:37 +02:00
Nicolas Grekas
7cf3fb4a21 Prepare for PHP 7.4 preload 2019-06-15 00:30:02 +02:00
Fabien Potencier
8787bbc94a Merge branch '4.3' into 4.4
* 4.3:
  fixed CS
  fixed CS
  fixed CS
  Do not log or call the proxy function when the locale is the same
  Added missing required dependencies on psr/cache and psr/container in symfony/cache-contracts and symfony/service-contracts respectively.
  [HttpClient] fix closing debug stream prematurely
  [Mailer] made code more robust
  Restore compatibility with php 5.5
  fixed sender/recipients in SMTP Envelope
  collect called listeners information only once
  [HttpKernel] Remove TestEventDispatcher.
2019-06-13 13:05:05 +02:00
Fabien Potencier
9526988eca fixed CS 2019-06-13 13:03:18 +02:00
Fabien Potencier
84bc7aba91 Merge branch '4.2' into 4.3
* 4.2:
  fixed CS
  fixed CS
  [HttpKernel] Remove TestEventDispatcher.
2019-06-13 13:01:17 +02:00
Fabien Potencier
37fa45bbd1 fixed CS 2019-06-13 12:57:15 +02:00
Michael Bessolov
9cbeb63613
Added missing required dependencies on psr/cache and psr/container
in symfony/cache-contracts and symfony/service-contracts respectively.
2019-06-12 23:16:15 -07:00
Nicolas Grekas
d3055814ad Merge branch '4.3' into 4.4
* 4.3:
  [Cache] Fixed undefined variable in ArrayTrait
  [HttpClient] revert bad logic around JSON_THROW_ON_ERROR
  [HttpKernel] Fix handling non-catchable fatal errors
  Fix json-encoding when JSON_THROW_ON_ERROR is used
  [HttpFoundation] work around PHP 7.3 bug related to json_encode()
  [HttpClient] add $response->cancel()
  [Security] added support for updated \"distinguished name\" format in x509 authentication
2019-06-05 15:27:25 +02:00
Fabien Potencier
e5b082acee bug #31850 [HttpClient] add $response->cancel() (nicolas-grekas)
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] add $response->cancel()

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/11668

An alternative to #31845 and #31842.
Same as  #31831 but considered as a bug fix (at the Contracts level), thus for 4.3.
I think we're early enough since 4.3/1.1 to do it.
That will save us some headaches in the short term.

Commits
-------

c402418723 [HttpClient] add $response->cancel()
2019-06-05 15:19:12 +02:00
Fabien Potencier
7207849037 Merge branch '4.3' into 4.4
* 4.3:
  [Console] Add check for Konsole/Yakuake to disable hyperlinks
  [HttpClient] work around PHP 7.3 bug related to json_encode()
  [VarDumper] fix dumping the cloner itself
  Rename the Symfony Mailer service config to avoid conflict with SwitMailer
  Set default crypto method - Fix #31105
  [Form] add missing symfony/service-contracts dependency
  [HttpClient] Don't throw InvalidArgumentException on bad Location header
2019-06-05 04:26:21 +02:00
Nicolas Grekas
c402418723 [HttpClient] add $response->cancel() 2019-06-04 13:36:30 +02:00
Nicolas Grekas
4acca42330 [HttpClient] Don't throw InvalidArgumentException on bad Location header 2019-06-04 10:32:15 +02:00
Nicolas Grekas
549930e820 [HttpClient] add $response->cancel() 2019-06-03 20:11:29 +02:00
Robin Chalas
8e5b6573ea Merge branch '4.3' into 4.4
* 4.3:
  [Security\Core] Make SodiumPasswordEncoder validate BCrypt-ed passwords
  [Validator] Fix TimezoneValidator default option
  [Messenger] Inject RoutableMessageBus instead of bus locator
  [DomCrawler] Fix type error with null Form::$currentUri
  [Contracts] Fixed typos
  do not enable validator auto mapping by default
  [HttpClient] remove unused argument
2019-05-31 20:55:48 +02:00
SAMUEL NELA
0bb8ba4ea4
[Contracts] Fixed typos 2019-05-31 00:41:44 +02:00
Nicolas Grekas
384393cb36 Allow Symfony 5.0 2019-05-28 17:53:17 +02:00
Nicolas Grekas
90167c36f8 fix tests 2019-05-28 11:19:25 +02:00
Nicolas Grekas
cfeb5bee07 fix tests 2019-05-28 09:50:59 +02:00
Chris Wilkinson
b27b4199fc
Fix typo 2019-05-27 11:52:29 +01:00
Nicolas Grekas
0a640c53cb Reference individual contracts packages 2019-05-27 10:16:38 +02:00
Nicolas Grekas
f410691842 [Contracts] split in one package per sub-contracts 2019-05-22 14:23:29 +02:00
Nicolas Grekas
7a53e8d3f9 Merge branch '4.2' into 4.3
* 4.2:
  [Routing] Fixed unexpected 404 NoConfigurationException
  [DI] Removes number of elements information in debug mode
  [Contracts] Simplify implementation declarations
  Update PR template for 4.3
  [Intl] Add FallbackTrait for data generation
  [Console] Commands with an alias should not be recognized as ambiguous
  clarify the possible class/interface of the cache
2019-05-09 11:33:12 +02:00
Nicolas Grekas
7d51da36a7 [Contracts] Simplify implementation declarations 2019-05-09 09:39:53 +02:00
Mehdi Achour
c5819f444d
[HttpClient] fix typo 2019-04-27 15:29:50 +01:00
Nicolas Grekas
8f699541f5 [HttpClient] fix too high timeout in test 2019-04-15 19:24:46 +02:00
Alexander M. Turek
8acf29eaf5 There is no OB to flush. 2019-04-07 10:26:05 +02:00
Nicolas Grekas
847a9bb86d [Cache] add logs on early-recomputation and locking 2019-04-03 11:22:57 +02:00
Nicolas Grekas
0b21268bf5 [HttpClient][Contracts] rename "raw_headers" to "response_headers" 2019-04-02 12:06:39 +02:00
Fabien Potencier
07276642de fixed typo 2019-03-31 15:49:16 +02:00
Nicolas Grekas
a4ce08ec30 [Contracts][EventDispatcher] move the Event class to symfony/contracts 2019-03-29 19:47:03 +01:00
Mateusz Sip
aaf5422cfb [DI][Contracts] add and implement ServiceProviderInterface 2019-03-28 12:22:02 +01:00
Fabien Potencier
c949f9a282 feature #30691 [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This PR adds a new `EventDispatcherInterface` in `Contracts`. This interface contains only one method: `dispatch($event, $eventName)`. That covers almost all use cases of the event dispatcher in components (some use add/removeListeners/Subscribers but they are a minority.)

While doing so, it allows dispatching any objects as events - not only instances of `Event`.

This allows decoupling e.g. `Messenger` from the `EventDispatcher` component.
Next steps could be about planning to remove the base `Event` class from some concrete event classes and/or moving `EventSubscriberInterface` to `symfony/contracts`. It would allow decoupling e.g. `Workflow` from the component - but that's too far away for now, let's think about it in 5.1.

Commits
-------

3c3db2f14a [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible
2019-03-27 07:28:10 +01:00
Gregor Harlan
226dbbc54f
[Contracts] fix phpdoc for http-client (user_data) 2019-03-26 00:17:13 +01:00
Nicolas Grekas
3c3db2f14a [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible 2019-03-25 18:18:00 +01:00
Fabien Potencier
dae5686722 [HttpClient] added CachingHttpClient 2019-03-22 16:52:17 +01:00
Fabien Potencier
d5d1b50cf7 feature #30604 [HttpClient] add MockHttpClient (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[HttpClient] add MockHttpClient

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This PR introduces `MockHttpClient` and `MockResponse`, to be used for testing classes that need an HTTP client without making actual HTTP requests.

`MockHttpClient` is configured via its constructor: you provide it either with an iterable or a callable, and these will be used to provide responses as the consumer requests them.

Example:
```php
$responses = [
    new MockResponse($body1, $info1),
    new MockResponse($body2, $info2),
];

$client = new MockHttpClient($responses);
$response1 = $client->request(...); // created from $responses[0]
$response2 = $client->request(...); // created from $responses[1]
```

Or alternatively:
```php
$callback = function ($method, $url, $options) {
    return new MockResponse(...);
};

$client = new MockHttpClient($callback);
$response = $client->request(...); // calls $callback internal
```

The responses provided to the client don't have to be instances of `MockResponse` - any `ResponseInterface` works (e.g. `$this->getMockBuilder(ResponseInterface::class)->getMock()`).

Using `MockResponse` allows simulating chunked responses and timeouts:
```php
$body = function () {
    yield 'hello';
    yield ''; // the empty string is turned into a timeout so that they are easy to test
    yield 'world';
};
$mockResponse = new Mockresponse($body);
```

Last but not least, the implementation simulates the full lifecycle of a properly behaving `HttpClientInterface` contracts implementation: error handling, progress function, etc. This is "proved" by `MockHttpClientTest`, who implements and passes the reference test suite in `HttpClientTestCase`.

Commits
-------

8fd7584158 [HttpClient] add MockHttpClient
2019-03-19 19:41:07 +01:00
Nicolas Grekas
8fd7584158 [HttpClient] add MockHttpClient 2019-03-19 19:38:55 +01:00
Anton Chernikov
103448cc67 [HttpClient] exceptions carry response 2019-03-19 08:49:42 +01:00
Kévin Dunglas
8d5096a638
[HttpClient] Allow to pass user/pw as an array 2019-03-14 08:32:36 +01:00
Kévin Dunglas
f79ef21458 [HttpClient] Add new bearer option 2019-03-14 08:15:49 +01:00
Nicolas Grekas
e11ef7ed12 [HttpClient] yield a last chunk for completed responses also 2019-03-11 12:00:28 +01:00
Nicolas Grekas
f54c89c530 [HttpClient] add missing test case 2019-03-10 23:05:39 +01:00
Nicolas Grekas
4619ae483d feature #30499 [HttpClient] add ResponseInterface::toArray() (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[HttpClient] add ResponseInterface::toArray()

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

I'd like we discuss adding a `toArray()` method to `ResponseInterface`.

JSON responses are so common when doing server-side requests that this may help remove boilerplate - especially the logic dealing with errors.

WDYT?

(about flags, I don't think we should make them configurable: if one really needs to deal with custom flags, there's always `ResponseInterface::getContent()` - but it should be very rare.).

Commits
-------

aabd1d455e [HttpClient] add ResponseInterface::toArray()
2019-03-10 18:25:55 +01:00
Nicolas Grekas
aabd1d455e [HttpClient] add ResponseInterface::toArray() 2019-03-09 17:49:48 +01:00
Nicolas Grekas
0e2ea87199 [HttpClient] Remove dead code 2019-03-09 17:08:21 +01:00
Nicolas Grekas
3eca2b448d [HttpClient] fixes 2019-03-08 17:57:56 +01:00
Nicolas Grekas
d2d63a28e1 [Contracts] introduce HttpClient contracts 2019-03-07 17:16:38 +01:00
Nicolas Grekas
aa6a60ead6 [Contracts] bump branch alias 2019-03-04 11:50:13 +01:00
Fabien Potencier
e03db43894 fixed CS 2019-01-16 22:31:25 +01:00
Fabien Potencier
d2098d7e5d fixed CS 2019-01-16 21:35:37 +01:00
Christian Flothmann
36110b1e95 update years in license files 2019-01-03 10:09:06 +01:00
Nicolas Grekas
73e4a1a5ff [Contracts] extract LocaleAwareInterface out of TranslatorInterface 2018-12-05 08:06:11 +00:00
Nicolas Grekas
302b8446a7 [Contracts][Cache] allow retrieving metadata of cached items 2018-11-24 10:35:08 +01:00
Nicolas Grekas
07e2cc2858 [Contracts] clarify the README 2018-11-21 19:26:39 +01:00
Nicolas Grekas
fd74951405 Merge branch '4.1'
* 4.1:
  [Form] Hardened test suite for empty data
  Bump phpunit XSD version to 5.2
  [Fwb][EventDispatcher][HttpKernel] Fix getClosureScopeClass usage to describe callables
  Add required key attribute
2018-11-11 20:52:12 +01:00
Nicolas Grekas
321d7f4be0 [Cache] allow to skip saving the computed value when using CacheInterface::get() 2018-10-31 09:00:32 +01:00
Fabien Potencier
51f39b9999 feature #28718 [Cache] add CacheInterface::delete() + improve CacheTrait (nicolas-grekas)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[Cache] add CacheInterface::delete() + improve CacheTrait

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

I've been hesitating a lot on this topic, but I think we should add a `delete()` method to `CacheInterface`.
Deleting is a very common invalidation strategy and invalidating by passing `$beta=INF` to `get()` has the drawback of requiring a fetch+unserialize+save-with-past-expiration. That's complexity that a delete removes.

This PR fixes an issue found meanwhile on `get()`: passing an `ItemInterface` to its callback makes it harder than required to implement on top of PSR-6. Let's pass a `CacheItemInterface`.

Lastly, the early expiration logic can be moved from the component to the trait shipped on contracts.

Here we are for all these steps.

Commits
-------

c6cf690b2f [Cache] add CacheInterface::delete() + improve CacheTrait
2018-10-10 02:20:36 -07:00
Nicolas Grekas
dc5f3bfff7 Make trans + %count% parameter resolve plurals 2018-10-06 18:22:22 +02:00
Nicolas Grekas
c6cf690b2f [Cache] add CacheInterface::delete() + improve CacheTrait 2018-10-06 16:52:09 +02:00
Nyholm
d870a850bd [Translator] Deprecated transChoice and moved it away from contracts 2018-10-06 09:58:31 +02:00
Nicolas Grekas
8a11e76c14 [Contracts] fine tune composer.json declarations for suggest/provide 2018-09-20 15:44:19 +02:00
Nyholm
06cd8dca8f [Cache][Contracts] We must save the item or the trait does not have any effect 2018-09-17 20:09:31 +02:00
Nicolas Grekas
675abdcfee [Contracts] Add traits+interfaces from the DI component 2018-09-04 10:20:02 +02:00
Nicolas Grekas
ca6478bbbb [Contracts] Add Cache contract to extend PSR-6 with tag invalidation, callback-based computation and stampede protection 2018-09-04 09:16:03 +02:00
Nicolas Grekas
064e369e06 [Contracts] Add Translation\TranslatorInterface + decouple symfony/validator from symfony/translation 2018-09-03 15:19:33 +02:00
Christian Flothmann
ec795cca78 fix compatibility with older Cache versions
FrameworkBundle 4.2 will be compatible with older versions of the Cache
component. In those versions adapters don't implement `ResetInterface`.
For backwards compatibility they still need to be tagged.
2018-07-14 10:12:57 +02:00
Fabien Potencier
682836da9c renamed Contract to Contracts 2018-07-13 19:06:58 +02:00