Skip to content

Commit

Permalink
Remove dev dependency on laminas/laminas-cache-storage-deprecated-fac…
Browse files Browse the repository at this point in the history
…tory

Signed-off-by: ramchale <[email protected]>
  • Loading branch information
ramchale committed Oct 22, 2024
1 parent fbeaa2a commit 65480f1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 68 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"require-dev": {
"laminas/laminas-cache": "^3.12.1",
"laminas/laminas-cache-storage-adapter-memory": "^2.3.0",
"laminas/laminas-cache-storage-deprecated-factory": "^1.2",
"laminas/laminas-coding-standard": "~2.5.0",
"laminas/laminas-config": "^3.9.0",
"laminas/laminas-eventmanager": "^3.13",
Expand Down
61 changes: 1 addition & 60 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@
<code><![CDATA[$file['type']]]></code>
<code><![CDATA[$file['type']]]></code>
<code><![CDATA[$loaderType]]></code>
<code><![CDATA[$options['cache']]]></code>
<code><![CDATA[$pattern['base_dir']]]></code>
<code><![CDATA[$pattern['pattern']]]></code>
<code><![CDATA[$pattern['pattern']]]></code>
Expand Down
4 changes: 4 additions & 0 deletions src/Translator/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ public static function factory($options)
if ($options['cache'] instanceof CacheStorage) {
$translator->setCache($options['cache']);
} else {
/**
* @psalm-suppress UndefinedClass
* @psalm-suppress MixedArgument
*/
$translator->setCache(Cache\StorageFactory::factory($options['cache']));
}
}
Expand Down
11 changes: 5 additions & 6 deletions test/Translator/TranslatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace LaminasTest\I18n\Translator;

use Laminas\Cache\Storage\Adapter\Memory;
use Laminas\Cache\Storage\StorageInterface;
use Laminas\Cache\StorageFactory as CacheFactory;

Check failure on line 9 in test/Translator/TranslatorTest.php

View workflow job for this annotation

GitHub Actions / ci / QA Checks (PHPCodeSniffer [8.1, locked], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Type Laminas\Cache\StorageFactory (as CacheFactory) is not used in this file.
use Laminas\EventManager\Event;
Expand Down Expand Up @@ -133,9 +134,7 @@ public function testFactoryCreatesTranslatorWithCache(): void
'pattern' => 'translation-%s.php',
],
],
'cache' => [
'adapter' => 'memory',
],
'cache' => new Memory(),
]);

self::assertInstanceOf(Translator::class, $translator);
Expand Down Expand Up @@ -172,7 +171,7 @@ public function testTranslate(): void

public function testTranslationsLoadedFromCache(): void
{
$cache = CacheFactory::factory(['adapter' => 'memory']);
$cache = new Memory();
$this->translator->setCache($cache);

$cache->addItem(
Expand All @@ -185,7 +184,7 @@ public function testTranslationsLoadedFromCache(): void

public function testTranslationsAreStoredInCache(): void
{
$cache = CacheFactory::factory(['adapter' => 'memory']);
$cache = new Memory();
$this->translator->setCache($cache);

$loader = new TestLoader();
Expand All @@ -208,7 +207,7 @@ public function testTranslationsAreClearedFromCache(): void
$textDomain = 'default';
$locale = 'en_EN';

$cache = CacheFactory::factory(['adapter' => 'memory']);
$cache = new Memory();
$this->translator->setCache($cache);

$cache->addItem(
Expand Down

0 comments on commit 65480f1

Please sign in to comment.