Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/cache
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.4.46
Choose a base ref
...
head repository: symfony/cache
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.0.0
Choose a head ref

Commits on May 19, 2021

  1. Copy the full SHA
    1d5b43c View commit details
  2. Merge branch '5.4' into 6.0

    * 5.4:
      Allow Symfony 6
    derrabus committed May 19, 2021
    Copy the full SHA
    595174a View commit details

Commits on May 20, 2021

  1. Copy the full SHA
    d3d3e78 View commit details

Commits on May 21, 2021

  1. Copy the full SHA
    dd6c2d3 View commit details

Commits on May 23, 2021

  1. Remove constraint for PHP < 8

    jderusse authored and nicolas-grekas committed May 23, 2021
    Copy the full SHA
    bfbba45 View commit details
  2. feature #41353 [Cache] Removed depreacted code (malteschlueter)

    This PR was merged into the 6.0 branch.
    
    Discussion
    ----------
    
    [Cache] Removed depreacted code
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.0
    | Bug fix?      | no
    | New feature?  | no
    | Deprecations? | yes
    | Tickets       | -
    | License       | MIT
    | Doc PR        | -
    
    This remove deprecated code from Cache.
    
    Is it necessary for the Changelog or Upgrade.md that the classes are not configurable anymore?
    
    Commits
    -------
    
    33a095dbf6 [Cache] Removed depreacted code
    nicolas-grekas committed May 23, 2021
    Copy the full SHA
    8c76cc7 View commit details

Commits on May 26, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      Fix CS in README files
      Fix markdown
      [HttpKernel] Fixes tests for PHP7.4+
      fix test
      [HttpKernel] Throw when HttpKernel is created and the env is empty
      [FrameworkBundle] Deprecate the `AdapterInterface` autowiring alias, use `CacheItemPoolInterface` instead
      [Filesystem] fix readlink for Windows
    nicolas-grekas committed May 26, 2021
    Copy the full SHA
    e9e568d View commit details

Commits on May 28, 2021

  1. Leverage Stringable

    nicolas-grekas committed May 28, 2021
    Copy the full SHA
    b3aa389 View commit details

Commits on Jun 2, 2021

  1. Copy the full SHA
    97ccdab View commit details

Commits on Jun 9, 2021

  1. Bump Contracts to 2.5

    nicolas-grekas committed Jun 9, 2021
    Copy the full SHA
    7e3b1e8 View commit details

Commits on Jun 24, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4: (29 commits)
      [DI] fix fixture
      [ErrorHandler] fix handling buffered SilencedErrorContext
      [HttpClient] fix Psr18Client when allow_url_fopen=0
      [DependencyInjection] Add support of PHP enumerations
      [Cache] handle prefixed redis connections when clearing pools
      [Cache] fix eventual consistency when using RedisTagAwareAdapter with a cluster
      [Uid] Prevent double validation in Uuid::fromString() with base32 values
      [Uid] Fix fromString() with low base58 values
      [Notifier] Add options to Microsoft Teams notifier
      [Notifier] Add Telnyx notifier bridge
      [Validator][Translation] Add ExpressionLanguageSyntax en and fr
      [HttpKernel] [HttpCache] Keep s-maxage=0 from ESI sub-responses
      Avoid broken action URL in text notification mail
      [FrameworkBundle] Add commented base64 version of secrets' keys
      [WebProfilerBundle] Improved the light/dark theme switching
      Fix references to CheckRememberMeConditionsListener
      [DependencyInjection] accept service locator definitions with no class
      [Cache] Disable locking on Windows by default
      [HttpClient] Add default base_uri to MockHttpClient
      [DependencyInjection] Fix binding "iterable $foo" when using the PHP-DSL
      ...
    nicolas-grekas committed Jun 24, 2021
    Copy the full SHA
    65db095 View commit details

Commits on Jun 30, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      Fix tests
      CS fix
      CS fix
      CS fix
      CS fixes
      Bump Symfony version to 5.3.4
      Update VERSION for 5.3.3
      Update CHANGELOG for 5.3.3
      Bump Symfony version to 5.2.12
      Update VERSION for 5.2.11
      Update CHANGELOG for 5.2.11
      Bump Symfony version to 4.4.27
      Update VERSION for 4.4.26
      Update CONTRIBUTORS for 4.4.26
      Update CHANGELOG for 4.4.26
    nicolas-grekas committed Jun 30, 2021
    Copy the full SHA
    cc8112b View commit details

Commits on Jul 4, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [FrameworkBundle] Add missing dep
      CS fix
      Missing translations from traits
      Fix SkippedTestSuite
      [Console] Fix type annotation on InputInterface::hasArgument()
      [Notifier] add Mailjet SMS bridge
      Revert "minor #41949 [Console] fix type annotations on InputInterface (nicolas-grekas)"
      [EventDispatcher] Correct the called event listener method case
      [Serializer] Need to clear cache when updating Annotation Groups on Entities
      Add missing translations for Japanese.
      Revert "bug #41952 [Console] fix handling positional arguments (nicolas-grekas)"
      Fix test
      [Security] Don't skip UserPasswordValidatorTest
      [DI] CS fix
      [Console] fix handling positional arguments
      Add TesterTrait::assertCommandIsSuccessful() helper
      [Validator] add translation for Vietnamese
      Add Bulgarian translation for the validator
      fix backport
      [Console] fix type annotations on InputInterface
    nicolas-grekas committed Jul 4, 2021
    Copy the full SHA
    fc39227 View commit details
  2. Merge branch '5.4' into 6.0

    * 5.4:
      [Cache] Deprecate DoctrineProvider
      Allow to pass TranslatableMessage objects to the help option
    derrabus committed Jul 4, 2021
    Copy the full SHA
    fbcef1e View commit details
  3. [Cache] Remove DoctrineProvider

    Signed-off-by: Alexander M. Turek <me@derrabus.de>
    derrabus committed Jul 4, 2021
    Copy the full SHA
    1aa0f22 View commit details

Commits on Jul 6, 2021

  1. [Cache] Implement psr/cache 3

    Signed-off-by: Alexander M. Turek <me@derrabus.de>
    derrabus authored and nicolas-grekas committed Jul 6, 2021
    Copy the full SHA
    0114914 View commit details

Commits on Jul 7, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [Cache] backport type fixes
      [Cache] Remove MemcachedTrait
    nicolas-grekas committed Jul 7, 2021
    Copy the full SHA
    db5fb71 View commit details
  2. Merge branch '5.4' into 6.0

    * 5.4:
      [Cache] fix bad merge
    nicolas-grekas committed Jul 7, 2021
    Copy the full SHA
    65686a8 View commit details
  3. Copy the full SHA
    73f95d7 View commit details

Commits on Jul 9, 2021

  1. [Cache] Add types to private properties

    Signed-off-by: Alexander M. Turek <me@derrabus.de>
    derrabus committed Jul 9, 2021
    Copy the full SHA
    2c486b0 View commit details

Commits on Jul 10, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      clean up remaining event mocks
      fetch type information only once
      do not mock the Request class
      do not mock event classes
      Fix use_notify default value for PostgreSqlConnection
      recover from failed deserializations
      fix setDefaultCommand
      [ErrorHandle] Remove a link from the exception page
      [Validator] Added Ukrainian translations
      [DependencyInjection] Fix TaggedLocator attribute without index argument
      [GHA] Clarify some bits in the deps=high script
      [Cache] make `LockRegistry` use semaphores when possible
      [Security] Deprecate "always authenticate" and "exception on no token"
    xabbuh committed Jul 10, 2021
    Copy the full SHA
    52182f9 View commit details

Commits on Jul 13, 2021

  1. Copy the full SHA
    36fcb80 View commit details

Commits on Jul 14, 2021

  1. Copy the full SHA
    a556a8f View commit details

Commits on Jul 15, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [ErrorHandler] fix parsing `@return array<foo>` annotations
      [HttpFoundation] Fix return types of SessionHandler::gc()
      [Cache] Support decorated Dbal drivers in PdoAdapter
      [VarDumper] Support for intersection types
      Throw error if maximum block limit is reached for slack message options
    nicolas-grekas committed Jul 15, 2021
    Copy the full SHA
    b45dd09 View commit details

Commits on Jul 18, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      Indicate compatibility with psr/log 2 and 3
      [ci] Fix wrongly skipped integration tests
    derrabus committed Jul 18, 2021
    Copy the full SHA
    619527a View commit details
  2. Merge branch '5.4' into 6.0

    * 5.4:
      Simplify some code with null coalesce operator
      Don't use deprecated TestLogger class
    derrabus committed Jul 18, 2021
    Copy the full SHA
    f37739f View commit details

Commits on Jul 21, 2021

  1. Copy the full SHA
    520a05d View commit details
  2. Merge branch '5.4' into 6.0

    * 5.4:
      Fix intersection types on tests
      [Notifier] cs
      [Console] fix table setHeaderTitle without headers
      [Validator] remove `@internal` annotation on Constraint::__get()
    nicolas-grekas committed Jul 21, 2021
    Copy the full SHA
    a56e55d View commit details
  3. Merge branch '5.4' into 6.0

    * 5.4:
      Leverage str_contains/str_starts_with
      Leverage str_ends_with
    nicolas-grekas committed Jul 21, 2021
    Copy the full SHA
    c19818c View commit details

Commits on Jul 23, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [Cache] Add missing return type
      [5.2] Add missing `@return` annotations
      [4.4] Add missing `@return` annotations
      Handle lock with long key
      #42227 update phpdoc to recommend createIndex over ensureIndex
    nicolas-grekas committed Jul 23, 2021
    Copy the full SHA
    19acacb View commit details

Commits on Aug 9, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4: (31 commits)
      fix test
      Clarify goals of AbstractController
      cs fix
      [Security][Validator] Add missing translations for Indonesian (id)
      [Security] Deprecate legacy signatures
      [Notifier] fix typo firebase
      [SecurityBundle] Create a smooth upgrade path for security factories
      Add trailing Line return if last line is non empty
      Add trailing Line return if last line is non empty
      [Security] Deprecate `PassportInterface`
      Report mismatches between trans-unit id and source text via status script
      Do not add namespace argument to NullAdapter in CachePoolPass
      [FrameworkBundle] Update cache:clear help
      [HttpFoundation] Add `litespeed_finish_request` to `Response`
      Fix markup
      (minor) remove author tags from test classes
      [Notifier] add `SentMessageEvent` and `FailedMessageEvent`
      [HttpFoundation] Mark Request::get() internal
      Add missing to semi-colon to exception.js
      [FrameworkBundle] remove dead conditions in Translation Commands
      ...
    chalasr committed Aug 9, 2021
    Copy the full SHA
    2f7ea10 View commit details

Commits on Aug 10, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [Cache] fix wiring async cache recomputing in debug mode
    derrabus committed Aug 10, 2021
    Copy the full SHA
    642c921 View commit details

Commits on Aug 12, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      More return type fixes (bis)
      Cleanup `@return` annotations
    nicolas-grekas committed Aug 12, 2021
    Copy the full SHA
    7c4ce8c View commit details

Commits on Aug 13, 2021

  1. Copy the full SHA
    4253cbd View commit details

Commits on Aug 16, 2021

  1. Run php-cs-fixer

    nicolas-grekas committed Aug 16, 2021
    Copy the full SHA
    d49577e View commit details

Commits on Aug 17, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [Serializer] cs fix
      Cleanup more `@return` annotations
      [Form] Fix phpdoc on FormBuilderInterface
    nicolas-grekas committed Aug 17, 2021
    Copy the full SHA
    da7ffe1 View commit details

Commits on Aug 25, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      Fix tests
      [HttpKernel] skip test on appveyor
      [AMQP] [Messenger] Do not leak any credentials when connection fails
    nicolas-grekas committed Aug 25, 2021
    Copy the full SHA
    4b69856 View commit details

Commits on Aug 29, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [Cache] Fix comment in MemcachedAdapter
      [SecurityBundle] Fix broken mock
      [DomCrawler] Don't pass null to trim()
    derrabus committed Aug 29, 2021
    Copy the full SHA
    96bbb99 View commit details

Commits on Sep 1, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [Translation] Throw exception if symfony/finder is not installed for PhpExtractor
      fix tests
      Fix tests failing with DBAL 3
      Fix circular reference in autowired decorators
      [Security] Do not deauthenticate token on user change if not an AbstractToken
    derrabus committed Sep 1, 2021
    Copy the full SHA
    67a6e54 View commit details

Commits on Sep 3, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      Revert "bug #42831 [Mime] Update mime types (fabpot)"
      Clean about command description after Environment section was removed
      Fix implicit float to int cast
      [Mime] Update mime types
      [HttpKernel] Fix timeline in profiler
    derrabus committed Sep 3, 2021
    Copy the full SHA
    c0cf798 View commit details

Commits on Sep 7, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [DependencyInjection] Improve array phpdoc of `ContainerBuilder`
      Match 5.1 mailer configuration
      [Cache] Make sure PdoAdapter::prune() always returns a bool
      [HttpKernel] Fix broken mock
      [HttpClient] Fix handling timeouts when responses are destructed
      [PropertyInfo] Support for intersection types
    nicolas-grekas committed Sep 7, 2021
    Copy the full SHA
    4c9db88 View commit details
  2. Copy the full SHA
    daed599 View commit details

Commits on Sep 9, 2021

  1. Copy the full SHA
    a8c7c5f View commit details
  2. minor #42949 Remove needless TypeErrors (nicolas-grekas)

    This PR was merged into the 6.0 branch.
    
    Discussion
    ----------
    
    Remove needless TypeErrors
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.0
    | Bug fix?      | no
    | New feature?  | no
    | Deprecations? | no
    | Tickets       | -
    | License       | MIT
    | Doc PR        | -
    
    Commits
    -------
    
    c7d479ea51 Remove needless TypeErrors
    nicolas-grekas committed Sep 9, 2021
    Copy the full SHA
    0acd113 View commit details
  3. Merge branch '5.4' into 6.0

    * 5.4:
      [Cache] Add CouchbaseCollectionAdapter compatibility with sdk 3.0.0
      [Cache] Deprecate support for Doctrine Cache
    derrabus committed Sep 9, 2021
    Copy the full SHA
    75b5324 View commit details
  4. Fix tests

    Signed-off-by: Alexander M. Turek <me@derrabus.de>
    derrabus committed Sep 9, 2021
    Copy the full SHA
    9ed19df View commit details
  5. Add missing types

    Signed-off-by: Alexander M. Turek <me@derrabus.de>
    derrabus committed Sep 9, 2021
    Copy the full SHA
    99cf644 View commit details
  6. Copy the full SHA
    ec86000 View commit details

Commits on Sep 24, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [VarDumper] fix dumping typed references from properties
      [VarDumper] minor optim on PHP 8.1
      Update README.md
      [Messenger] [Redis] Allow authentication with user and password
      [Cache] Throw ValueError in debug mode when serialization fails
      [FrameworkBundle] Avoid secrets:decrypt-to-local command to fail
      fix missing classes
      Mattermost Notifier option to post in an other channel
      [Messenger] Add WorkerMetadata to Worker class
    nicolas-grekas committed Sep 24, 2021
    Copy the full SHA
    f84a656 View commit details

Commits on Sep 26, 2021

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [SecurityBundle] Fixed LogicException message of FirewallAwareTrait
      [LDAP] Fix resource type checks & docblocks on PHP 8.1
      Revert "feature #43094 [Console] Add support of RGB functional notation (alexandre-daubois)"
      Fix Redis replication on Redis <5
      Fix decorating non-entrypoint authenticators
      [Ldap] Make LdapAuthenticator an EntryPoint
    chalasr committed Sep 26, 2021
    Copy the full SHA
    f9c1016 View commit details
Showing with 434 additions and 1,458 deletions.
  1. +2 −6 Adapter/AbstractAdapter.php
  2. +2 −6 Adapter/AbstractTagAwareAdapter.php
  3. +4 −8 Adapter/AdapterInterface.php
  4. +6 −6 Adapter/ApcuAdapter.php
  5. +18 −34 Adapter/ArrayAdapter.php
  6. +15 −29 Adapter/ChainAdapter.php
  7. +5 −10 Adapter/CouchbaseBucketAdapter.php
  8. +4 −12 Adapter/CouchbaseCollectionAdapter.php
  9. +0 −110 Adapter/DoctrineAdapter.php
  10. +14 −18 Adapter/DoctrineDbalAdapter.php
  11. +2 −6 Adapter/FilesystemTagAwareAdapter.php
  12. +11 −13 Adapter/MemcachedAdapter.php
  13. +10 −24 Adapter/NullAdapter.php
  14. +27 −227 Adapter/PdoAdapter.php
  15. +25 −41 Adapter/PhpArrayAdapter.php
  16. +13 −16 Adapter/PhpFilesAdapter.php
  17. +19 −33 Adapter/ProxyAdapter.php
  18. +6 −6 Adapter/Psr16Adapter.php
  19. +1 −6 Adapter/RedisAdapter.php
  20. +4 −9 Adapter/RedisTagAwareAdapter.php
  21. +21 −40 Adapter/TagAwareAdapter.php
  22. +1 −3 Adapter/TagAwareAdapterInterface.php
  23. +21 −32 Adapter/TraceableAdapter.php
  24. +1 −1 Adapter/TraceableTagAwareAdapter.php
  25. +6 −0 CHANGELOG.md
  26. +17 −25 CacheItem.php
  27. +2 −4 DataCollector/CacheDataCollector.php
  28. +4 −19 DependencyInjection/CacheCollectorPass.php
  29. +1 −12 DependencyInjection/CachePoolClearerPass.php
  30. +15 −42 DependencyInjection/CachePoolPass.php
  31. +3 −16 DependencyInjection/CachePoolPrunerPass.php
  32. +0 −120 DoctrineProvider.php
  33. +0 −1 LockRegistry.php
  34. +6 −6 Marshaller/DefaultMarshaller.php
  35. +2 −2 Marshaller/DeflateMarshaller.php
  36. +1 −3 Marshaller/MarshallerInterface.php
  37. +3 −3 Marshaller/SodiumMarshaller.php
  38. +2 −2 Marshaller/TagAwareMarshaller.php
  39. +4 −4 Messenger/EarlyExpirationDispatcher.php
  40. +2 −2 Messenger/EarlyExpirationHandler.php
  41. +8 −5 Messenger/EarlyExpirationMessage.php
  42. +1 −4 PruneableInterface.php
  43. +10 −26 Psr16Cache.php
  44. +1 −1 Tests/Adapter/AdapterTestCase.php
  45. +0 −35 Tests/Adapter/DoctrineAdapterTest.php
  46. +1 −1 Tests/Adapter/MaxIdLengthAdapterTest.php
  47. +2 −7 Tests/Adapter/MemcachedAdapterTest.php
  48. +0 −171 Tests/Adapter/PdoDbalAdapterTest.php
  49. +2 −2 Tests/Adapter/TagAwareAdapterTest.php
  50. +2 −2 Tests/DependencyInjection/CacheCollectorPassTest.php
  51. +0 −48 Tests/DoctrineProviderTest.php
  52. +0 −55 Tests/Fixtures/ArrayCache.php
  53. +4 −4 Tests/Marshaller/DefaultMarshallerTest.php
  54. +26 −47 Traits/AbstractAdapterTrait.php
  55. +9 −3 Traits/ContractsTrait.php
  56. +7 −10 Traits/FilesystemCommonTrait.php
  57. +6 −8 Traits/FilesystemTrait.php
  58. +2 −2 Traits/ProxyTrait.php
  59. +3 −6 Traits/RedisClusterNodeProxy.php
  60. +7 −7 Traits/RedisClusterProxy.php
  61. +3 −3 Traits/RedisProxy.php
  62. +10 −19 Traits/RedisTrait.php
  63. +17 −21 composer.json
  64. +13 −14 phpunit.xml.dist
8 changes: 2 additions & 6 deletions Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
@@ -98,10 +98,8 @@ static function ($deferred, $namespace, &$expiredIds, $getId, $defaultLifetime)
* Returns the best possible adapter that your runtime supports.
*
* Using ApcuAdapter makes system caches compatible with read-only filesystems.
*
* @return AdapterInterface
*/
public static function createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null)
public static function createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null): AdapterInterface
{
$opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true);
if (null !== $logger) {
@@ -145,10 +143,8 @@ public static function createConnection(string $dsn, array $options = [])

/**
* {@inheritdoc}
*
* @return bool
*/
public function commit()
public function commit(): bool
{
$ok = true;
$byLifetime = (self::$mergeByLifetime)($this->deferred, $this->namespace, $expiredIds, \Closure::fromCallable([$this, 'getId']), $this->defaultLifetime);
8 changes: 2 additions & 6 deletions Adapter/AbstractTagAwareAdapter.php
Original file line number Diff line number Diff line change
@@ -135,10 +135,8 @@ abstract protected function doSave(array $values, int $lifetime, array $addTagDa
* Removes multiple items from the pool and their corresponding tags.
*
* @param array $ids An array of identifiers that should be removed from the pool
*
* @return bool
*/
abstract protected function doDelete(array $ids);
abstract protected function doDelete(array $ids): bool;

/**
* Removes relations between tags and deleted items.
@@ -151,8 +149,6 @@ abstract protected function doDeleteTagRelations(array $tagData): bool;
* Invalidates cached items using tags.
*
* @param string[] $tagIds An array of tags to invalidate, key is tag and value is tag id
*
* @return bool
*/
abstract protected function doInvalidate(array $tagIds): bool;

@@ -282,7 +278,7 @@ public function deleteItems(array $keys): bool
/**
* {@inheritdoc}
*/
public function invalidateTags(array $tags)
public function invalidateTags(array $tags): bool
{
if (empty($tags)) {
return false;
12 changes: 4 additions & 8 deletions Adapter/AdapterInterface.php
Original file line number Diff line number Diff line change
@@ -26,22 +26,18 @@ interface AdapterInterface extends CacheItemPoolInterface
{
/**
* {@inheritdoc}
*
* @return CacheItem
*/
public function getItem($key);
public function getItem(mixed $key): CacheItem;

/**
* {@inheritdoc}
*
* @return \Traversable<string, CacheItem>
* @return iterable<string, CacheItem>
*/
public function getItems(array $keys = []);
public function getItems(array $keys = []): iterable;

/**
* {@inheritdoc}
*
* @return bool
*/
public function clear(string $prefix = '');
public function clear(string $prefix = ''): bool;
}
12 changes: 6 additions & 6 deletions Adapter/ApcuAdapter.php
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
*/
class ApcuAdapter extends AbstractAdapter
{
private $marshaller;
private ?MarshallerInterface $marshaller;

/**
* @throws CacheException if APCu is not enabled
@@ -55,7 +55,7 @@ public static function isSupported()
/**
* {@inheritdoc}
*/
protected function doFetch(array $ids)
protected function doFetch(array $ids): iterable
{
$unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
try {
@@ -77,15 +77,15 @@ protected function doFetch(array $ids)
/**
* {@inheritdoc}
*/
protected function doHave(string $id)
protected function doHave(string $id): bool
{
return apcu_exists($id);
}

/**
* {@inheritdoc}
*/
protected function doClear(string $namespace)
protected function doClear(string $namespace): bool
{
return isset($namespace[0]) && class_exists(\APCuIterator::class, false) && ('cli' !== \PHP_SAPI || filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN))
? apcu_delete(new \APCuIterator(sprintf('/^%s/', preg_quote($namespace, '/')), \APC_ITER_KEY))
@@ -95,7 +95,7 @@ protected function doClear(string $namespace)
/**
* {@inheritdoc}
*/
protected function doDelete(array $ids)
protected function doDelete(array $ids): bool
{
foreach ($ids as $id) {
apcu_delete($id);
@@ -107,7 +107,7 @@ protected function doDelete(array $ids)
/**
* {@inheritdoc}
*/
protected function doSave(array $values, int $lifetime)
protected function doSave(array $values, int $lifetime): array|bool
{
if (null !== $this->marshaller && (!$values = $this->marshaller->marshall($values, $failed))) {
return $failed;
52 changes: 18 additions & 34 deletions Adapter/ArrayAdapter.php
Original file line number Diff line number Diff line change
@@ -30,14 +30,14 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
{
use LoggerAwareTrait;

private $storeSerialized;
private $values = [];
private $expiries = [];
private $defaultLifetime;
private $maxLifetime;
private $maxItems;
private bool $storeSerialized;
private array $values = [];
private array $expiries = [];
private int $defaultLifetime;
private float $maxLifetime;
private int $maxItems;

private static $createCacheItem;
private static \Closure $createCacheItem;

/**
* @param bool $storeSerialized Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise
@@ -73,7 +73,7 @@ static function ($key, $value, $isHit) {
/**
* {@inheritdoc}
*/
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null): mixed
{
$item = $this->getItem($key);
$metadata = $item->getMetadata();
@@ -97,10 +97,8 @@ public function delete(string $key): bool

/**
* {@inheritdoc}
*
* @return bool
*/
public function hasItem($key)
public function hasItem(mixed $key): bool
{
if (\is_string($key) && isset($this->expiries[$key]) && $this->expiries[$key] > microtime(true)) {
if ($this->maxItems) {
@@ -120,7 +118,7 @@ public function hasItem($key)
/**
* {@inheritdoc}
*/
public function getItem($key)
public function getItem(mixed $key): CacheItem
{
if (!$isHit = $this->hasItem($key)) {
$value = null;
@@ -139,7 +137,7 @@ public function getItem($key)
/**
* {@inheritdoc}
*/
public function getItems(array $keys = [])
public function getItems(array $keys = []): iterable
{
\assert(self::validateKeys($keys));

@@ -148,10 +146,8 @@ public function getItems(array $keys = [])

/**
* {@inheritdoc}
*
* @return bool
*/
public function deleteItem($key)
public function deleteItem(mixed $key): bool
{
\assert('' !== CacheItem::validateKey($key));
unset($this->values[$key], $this->expiries[$key]);
@@ -161,10 +157,8 @@ public function deleteItem($key)

/**
* {@inheritdoc}
*
* @return bool
*/
public function deleteItems(array $keys)
public function deleteItems(array $keys): bool
{
foreach ($keys as $key) {
$this->deleteItem($key);
@@ -175,10 +169,8 @@ public function deleteItems(array $keys)

/**
* {@inheritdoc}
*
* @return bool
*/
public function save(CacheItemInterface $item)
public function save(CacheItemInterface $item): bool
{
if (!$item instanceof CacheItem) {
return false;
@@ -230,30 +222,24 @@ public function save(CacheItemInterface $item)

/**
* {@inheritdoc}
*
* @return bool
*/
public function saveDeferred(CacheItemInterface $item)
public function saveDeferred(CacheItemInterface $item): bool
{
return $this->save($item);
}

/**
* {@inheritdoc}
*
* @return bool
*/
public function commit()
public function commit(): bool
{
return true;
}

/**
* {@inheritdoc}
*
* @return bool
*/
public function clear(string $prefix = '')
public function clear(string $prefix = ''): bool
{
if ('' !== $prefix) {
$now = microtime(true);
@@ -276,10 +262,8 @@ public function clear(string $prefix = '')

/**
* Returns all cached values, with cache miss as null.
*
* @return array
*/
public function getValues()
public function getValues(): array
{
if (!$this->storeSerialized) {
return $this->values;
Loading