Skip to content

Commit 5bde54c

Browse files
chore
1 parent c725a8f commit 5bde54c

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

framework/core/src/Foundation/AbstractValidator.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ abstract class AbstractValidator
1919
{
2020
use ExtensionIdTrait;
2121

22-
public static string $CORE_VALIDATION_CACHE_KEY = 'core.validation.extension_id_class_names';
22+
/**
23+
* @var string
24+
*/
25+
public static $CORE_VALIDATION_CACHE_KEY = 'core.validation.extension_id_class_names';
2326

2427
/**
2528
* @var array
@@ -46,20 +49,14 @@ public function addConfiguration($callable)
4649
*/
4750
protected $translator;
4851

49-
/**
50-
* @var Cache
51-
*/
52-
protected $cache;
53-
5452
/**
5553
* @param Factory $validator
5654
* @param TranslatorInterface $translator
5755
*/
58-
public function __construct(Factory $validator, TranslatorInterface $translator, Cache $cache)
56+
public function __construct(Factory $validator, TranslatorInterface $translator)
5957
{
6058
$this->validator = $validator;
6159
$this->translator = $translator;
62-
$this->cache = $cache;
6360
}
6461

6562
/**
@@ -97,8 +94,10 @@ protected function getMessages()
9794
*/
9895
protected function getAttributeNames()
9996
{
100-
if ($this->cache->get(self::$CORE_VALIDATION_CACHE_KEY) !== null) {
101-
return $this->cache->get(self::$CORE_VALIDATION_CACHE_KEY);
97+
$cache = resolve(Cache::class);
98+
99+
if ($cache->get(self::$CORE_VALIDATION_CACHE_KEY) !== null) {
100+
return $cache->get(self::$CORE_VALIDATION_CACHE_KEY);
102101
}
103102

104103
$extId = $this->getClassExtensionId();
@@ -109,7 +108,7 @@ protected function getAttributeNames()
109108
$attributeNames[$attribute] = $this->translator->trans($key);
110109
}
111110

112-
$this->cache->forever(self::$CORE_VALIDATION_CACHE_KEY, $attributeNames);
111+
$cache->forever(self::$CORE_VALIDATION_CACHE_KEY, $attributeNames);
113112

114113
return $attributeNames;
115114
}

0 commit comments

Comments
 (0)