diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index 53de9ec014c..af4d83776b8 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -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; } @@ -152,6 +157,10 @@ protected function restart($command): void ]; } + if ($opcache_loaded) { + $additional_options[] = '-dopcache.save_comments=1'; + } + array_splice( $command, 1,