Skip to content

Commit

Permalink
misc!: remove deprecated method to set cache directory
Browse files Browse the repository at this point in the history
It is now mandatory to register cache instances using the method
`\CuyZ\Valinor\MapperBuilder::withCache()`.
  • Loading branch information
romm committed Nov 23, 2022
1 parent ceb1972 commit b0d6d2f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
18 changes: 0 additions & 18 deletions src/MapperBuilder.php
Expand Up @@ -4,7 +4,6 @@

namespace CuyZ\Valinor;

use CuyZ\Valinor\Cache\FileSystemCache;
use CuyZ\Valinor\Library\Container;
use CuyZ\Valinor\Library\Settings;
use CuyZ\Valinor\Mapper\ArgumentsMapper;
Expand Down Expand Up @@ -421,23 +420,6 @@ public function filterExceptions(callable $filter): self
return $clone;
}

/**
* @deprecated instead, use:
*
* ```php
* (new \CuyZ\Valinor\MapperBuilder())
* ->withCache(new FileSystemCache('cache-directory'))
* ->mapper()
* ->map(SomeClass::class, [
* // …
* ]);
* ```
*/
public function withCacheDir(string $cacheDir): self
{
return $this->withCache(new FileSystemCache($cacheDir));
}

/**
* Warms up the injected cache implementation with the provided class names.
*
Expand Down
2 changes: 0 additions & 2 deletions tests/Unit/MapperBuilderTest.php
Expand Up @@ -38,7 +38,6 @@ public function test_builder_methods_return_clone_of_builder_instance(): void
$builderI = $builderA->allowPermissiveTypes();
$builderJ = $builderA->filterExceptions(fn () => new FakeErrorMessage());
$builderK = $builderA->withCache(new FakeCache());
$builderL = $builderA->withCacheDir(sys_get_temp_dir());

self::assertNotSame($builderA, $builderB);
self::assertNotSame($builderA, $builderC);
Expand All @@ -50,7 +49,6 @@ public function test_builder_methods_return_clone_of_builder_instance(): void
self::assertNotSame($builderA, $builderI);
self::assertNotSame($builderA, $builderJ);
self::assertNotSame($builderA, $builderK);
self::assertNotSame($builderA, $builderL);
}

public function test_mapper_instance_is_the_same(): void
Expand Down

0 comments on commit b0d6d2f

Please sign in to comment.