Skip to content

Commit 54d4aa6

Browse files
authored
Remove pluginManagerSetsCacheBackend.unclearCacheTag error (mglaman#841)
* Remove pluginManagerSetsCacheBackend.unclearCacheTag error fixes mglaman#824 * fix test and lint
1 parent e804eff commit 54d4aa6

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

src/Rules/Drupal/PluginManager/PluginManagerSetsCacheBackendRule.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
use PHPStan\Type\Type;
1111
use function array_map;
1212
use function count;
13-
use function sprintf;
14-
use function strpos;
1513

1614
/**
1715
* @extends AbstractPluginManagerRule<ClassMethod>
@@ -44,7 +42,6 @@ public function processNode(Node $node, Scope $scope): array
4442
}
4543

4644
$hasCacheBackendSet = false;
47-
$misnamedCacheTagWarnings = [];
4845

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

71-
if (isset($setCacheBackendArgs[2])) {
72-
$cacheTagsType = $scope->getType($setCacheBackendArgs[2]->value);
73-
foreach ($cacheTagsType->getConstantArrays() as $constantArray) {
74-
foreach ($constantArray->getValueTypes() as $valueType) {
75-
foreach ($valueType->getConstantStrings() as $cacheTagConstantString) {
76-
foreach ($cacheKey as $cacheKeyValue) {
77-
if (strpos($cacheTagConstantString->getValue(), $cacheKeyValue) === false) {
78-
$misnamedCacheTagWarnings[] = $cacheTagConstantString->getValue();
79-
}
80-
}
81-
}
82-
}
83-
}
84-
}
85-
8668
break;
8769
}
8870
}
@@ -93,13 +75,6 @@ public function processNode(Node $node, Scope $scope): array
9375
->identifier('pluginManagerSetsCacheBackend.missingCacheBackend')
9476
->build();
9577
}
96-
foreach ($misnamedCacheTagWarnings as $cacheTagWarning) {
97-
$errors[] = RuleErrorBuilder::message(
98-
sprintf('%s cache tag might be unclear and does not contain the cache key in it.', $cacheTagWarning)
99-
)
100-
->identifier('pluginManagerSetsCacheBackend.unclearCacheTag')
101-
->build();
102-
}
10378

10479
return $errors;
10580
}

tests/src/Rules/PluginManagerSetsCacheBackendRuleTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ public static function ruleData(): \Generator
3535
'Missing cache backend declaration for performance.',
3636
12
3737
],
38-
[
39-
'plugins cache tag might be unclear and does not contain the cache key in it.',
40-
112,
41-
]
4238
]
4339
];
4440
}

0 commit comments

Comments
 (0)