Skip to content

Commit f0486cb

Browse files
authored
Remove pluginManagerSetsCacheBackend.unclearCacheTag error (#843)
Remove pluginManagerSetsCacheBackend.unclearCacheTag error (#841) * Remove pluginManagerSetsCacheBackend.unclearCacheTag error fixes #824 * fix test and lint (cherry picked from commit 54d4aa6)
1 parent 6d08c04 commit f0486cb

File tree

2 files changed

+0
-25
lines changed

2 files changed

+0
-25
lines changed

src/Rules/Drupal/PluginManager/PluginManagerSetsCacheBackendRule.php

-21
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
use PHPStan\Type\Type;
1010
use function array_map;
1111
use function count;
12-
use function sprintf;
13-
use function strpos;
1412

1513
/**
1614
* @extends AbstractPluginManagerRule<ClassMethod>
@@ -43,7 +41,6 @@ public function processNode(Node $node, Scope $scope): array
4341
}
4442

4543
$hasCacheBackendSet = false;
46-
$misnamedCacheTagWarnings = [];
4744

4845
foreach ($node->stmts ?? [] as $statement) {
4946
if ($statement instanceof Node\Stmt\Expression) {
@@ -67,21 +64,6 @@ public function processNode(Node $node, Scope $scope): array
6764
continue;
6865
}
6966

70-
if (isset($setCacheBackendArgs[2])) {
71-
$cacheTagsType = $scope->getType($setCacheBackendArgs[2]->value);
72-
foreach ($cacheTagsType->getConstantArrays() as $constantArray) {
73-
foreach ($constantArray->getValueTypes() as $valueType) {
74-
foreach ($valueType->getConstantStrings() as $cacheTagConstantString) {
75-
foreach ($cacheKey as $cacheKeyValue) {
76-
if (strpos($cacheTagConstantString->getValue(), $cacheKeyValue) === false) {
77-
$misnamedCacheTagWarnings[] = $cacheTagConstantString->getValue();
78-
}
79-
}
80-
}
81-
}
82-
}
83-
}
84-
8567
break;
8668
}
8769
}
@@ -90,9 +72,6 @@ public function processNode(Node $node, Scope $scope): array
9072
if (!$hasCacheBackendSet) {
9173
$errors[] = 'Missing cache backend declaration for performance.';
9274
}
93-
foreach ($misnamedCacheTagWarnings as $cacheTagWarning) {
94-
$errors[] = sprintf('%s cache tag might be unclear and does not contain the cache key in it.', $cacheTagWarning);
95-
}
9675

9776
return $errors;
9877
}

tests/src/Rules/PluginManagerSetsCacheBackendRuleTest.php

-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ public static function ruleData(): \Generator
3333
'Missing cache backend declaration for performance.',
3434
12
3535
],
36-
[
37-
'plugins cache tag might be unclear and does not contain the cache key in it.',
38-
112,
39-
]
4036
]
4137
];
4238
}

0 commit comments

Comments
 (0)