Skip to content

Commit

Permalink
Merge pull request #10614 from weirdan/fix-json-mapping-with-opcache.…
Browse files Browse the repository at this point in the history
…save_comments-0
  • Loading branch information
weirdan committed Jan 30, 2024
2 parents f045730 + 98756ba commit e02276a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Psalm/Internal/Fork/PsalmRestarter.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ protected function requiresRestart($default): bool
}
}

// opcache.save_comments is required for json mapper (used in language server) to work
if ($opcache_loaded && in_array(ini_get('opcache.save_comments'), ['0', 'false', 0, false])) {
return true;
}

return $default || $this->required;
}

Expand Down Expand Up @@ -152,6 +157,10 @@ protected function restart($command): void
];
}

if ($opcache_loaded) {
$additional_options[] = '-dopcache.save_comments=1';
}

array_splice(
$command,
1,
Expand Down

0 comments on commit e02276a

Please sign in to comment.