Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions src/Analyser/ResultCache/ResultCacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,27 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
}

/**
* @param mixed[] $cachedMeta
* @param mixed[] $currentMeta
* @param mixed[]|null $projectConfig
*/
private function isMetaDifferent(array $cachedMeta, array $currentMeta): bool
private function normalizeMetaProjectConfig(?array $projectConfig): ?string
{
$projectConfig = $currentMeta['projectConfig'];
if ($projectConfig !== null) {
ksort($currentMeta['projectConfig']);
ksort($projectConfig);

$currentMeta['projectConfig'] = Neon::encode($currentMeta['projectConfig']);
return Neon::encode($projectConfig);
}

return null;
}

/**
* @param mixed[] $cachedMeta
* @param mixed[] $currentMeta
*/
private function isMetaDifferent(array $cachedMeta, array $currentMeta): bool
{
$currentMeta['projectConfig'] = $this->normalizeMetaProjectConfig($currentMeta['projectConfig']);

return $cachedMeta !== $currentMeta;
}

Expand All @@ -337,6 +346,10 @@ private function getMetaKeyDifferences(array $cachedMeta, array $currentMeta): a
{
$diffs = [];
foreach ($cachedMeta as $key => $value) {
if ($key === 'projectConfig') {
$value = $this->normalizeMetaProjectConfig($value);
}

if (!array_key_exists($key, $currentMeta)) {
$diffs[] = $key;
continue;
Expand Down
Loading