diff --git a/UPGRADING.md b/UPGRADING.md index 7f023908f..990ceeebd 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -1,3 +1,8 @@ +Unreleased +========== + +- Use symfony/cache for FileSystem cache implementation instead of doctrine/cache + From 2.x to 3.0.0 ================= diff --git a/composer.json b/composer.json index a3440e215..e9fb2430d 100644 --- a/composer.json +++ b/composer.json @@ -24,8 +24,8 @@ "phpstan/phpdoc-parser": "^0.4 || ^0.5" }, "suggest": { - "doctrine/cache": "Required if you like to use cache functionality.", "doctrine/collections": "Required if you like to use doctrine collection types as ArrayCollection.", + "symfony/cache": "Required if you like to use cache functionality.", "symfony/yaml": "Required if you'd like to use the YAML metadata format." }, "require-dev": { diff --git a/src/SerializerBuilder.php b/src/SerializerBuilder.php index 4a9255657..5bdbec2fa 100644 --- a/src/SerializerBuilder.php +++ b/src/SerializerBuilder.php @@ -5,9 +5,8 @@ namespace JMS\Serializer; use Doctrine\Common\Annotations\AnnotationReader; -use Doctrine\Common\Annotations\CachedReader; +use Doctrine\Common\Annotations\PsrCachedReader; use Doctrine\Common\Annotations\Reader; -use Doctrine\Common\Cache\FilesystemCache; use JMS\Serializer\Accessor\AccessorStrategyInterface; use JMS\Serializer\Accessor\DefaultAccessorStrategy; use JMS\Serializer\Builder\DefaultDriverFactory; @@ -50,6 +49,7 @@ use Metadata\Cache\FileCache; use Metadata\MetadataFactory; use Metadata\MetadataFactoryInterface; +use Symfony\Component\Cache\Adapter\FilesystemAdapter; /** * Builder for serializer instances. @@ -525,8 +525,8 @@ public function build(): Serializer if (null !== $this->cacheDir) { $this->createDir($this->cacheDir . '/annotations'); - $annotationsCache = new FilesystemCache($this->cacheDir . '/annotations'); - $annotationReader = new CachedReader($annotationReader, $annotationsCache, $this->debug); + $annotationsCache = new FilesystemAdapter('', 0, $this->cacheDir . '/annotations'); + $annotationReader = new PsrCachedReader($annotationReader, $annotationsCache, $this->debug); } }