Skip to content

Commit

Permalink
Fix language server running with opcache.save_comments=0
Browse files Browse the repository at this point in the history
Fixes #10353
  • Loading branch information
weirdan committed Jan 30, 2024
1 parent f045730 commit 98756ba
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 98756ba

Please sign in to comment.