Skip to content

Commit 8f05c28

Browse files
janedbalondrejmirtes
authored andcommitted
ResultCacheManager: fix meta key difference for projectConfig
1 parent 6bdf04b commit 8f05c28

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/Analyser/ResultCache/ResultCacheManager.php

+19-6
Original file line numberDiff line numberDiff line change
@@ -313,18 +313,27 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
313313
}
314314

315315
/**
316-
* @param mixed[] $cachedMeta
317-
* @param mixed[] $currentMeta
316+
* @param mixed[]|null $projectConfig
318317
*/
319-
private function isMetaDifferent(array $cachedMeta, array $currentMeta): bool
318+
private function normalizeMetaProjectConfig(?array $projectConfig): ?string
320319
{
321-
$projectConfig = $currentMeta['projectConfig'];
322320
if ($projectConfig !== null) {
323-
ksort($currentMeta['projectConfig']);
321+
ksort($projectConfig);
324322

325-
$currentMeta['projectConfig'] = Neon::encode($currentMeta['projectConfig']);
323+
return Neon::encode($projectConfig);
326324
}
327325

326+
return null;
327+
}
328+
329+
/**
330+
* @param mixed[] $cachedMeta
331+
* @param mixed[] $currentMeta
332+
*/
333+
private function isMetaDifferent(array $cachedMeta, array $currentMeta): bool
334+
{
335+
$currentMeta['projectConfig'] = $this->normalizeMetaProjectConfig($currentMeta['projectConfig']);
336+
328337
return $cachedMeta !== $currentMeta;
329338
}
330339

@@ -338,6 +347,10 @@ private function getMetaKeyDifferences(array $cachedMeta, array $currentMeta): a
338347
{
339348
$diffs = [];
340349
foreach ($cachedMeta as $key => $value) {
350+
if ($key === 'projectConfig') {
351+
$value = $this->normalizeMetaProjectConfig($value);
352+
}
353+
341354
if (!array_key_exists($key, $currentMeta)) {
342355
$diffs[] = $key;
343356
continue;

0 commit comments

Comments
 (0)