mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Merge pull request #9326 from vimeo/prevent-jit-warnings
This commit is contained in:
commit
5fe902bde5
@ -237,7 +237,13 @@ final class LanguageServer
|
||||
|
||||
$ini_handler = new PsalmRestarter('PSALM');
|
||||
|
||||
$ini_handler->disableExtension('grpc');
|
||||
$ini_handler->disableExtensions([
|
||||
'grpc',
|
||||
'uopz',
|
||||
// extensions bellow are incompatible with JIT
|
||||
'pcov',
|
||||
'blackfire',
|
||||
]);
|
||||
|
||||
// If Xdebug is enabled, restart without it
|
||||
$ini_handler->check();
|
||||
|
@ -903,7 +903,12 @@ final class Psalm
|
||||
$ini_handler->disableExtension('grpc');
|
||||
}
|
||||
|
||||
$ini_handler->disableExtension('uopz');
|
||||
$ini_handler->disableExtensions([
|
||||
'uopz',
|
||||
// extesions that are incompatible with JIT (they are also usually make Psalm slow)
|
||||
'pcov',
|
||||
'blackfire',
|
||||
]);
|
||||
|
||||
// If Xdebug is enabled, restart without it
|
||||
$ini_handler->check();
|
||||
|
@ -3,13 +3,13 @@
|
||||
namespace Psalm\Internal\Cli;
|
||||
|
||||
use AssertionError;
|
||||
use Composer\XdebugHandler\XdebugHandler;
|
||||
use Psalm\Config;
|
||||
use Psalm\Exception\UnsupportedIssueToFixException;
|
||||
use Psalm\Internal\Analyzer\ProjectAnalyzer;
|
||||
use Psalm\Internal\CliUtils;
|
||||
use Psalm\Internal\Composer;
|
||||
use Psalm\Internal\ErrorHandler;
|
||||
use Psalm\Internal\Fork\PsalmRestarter;
|
||||
use Psalm\Internal\IncludeCollector;
|
||||
use Psalm\Internal\Provider\ClassLikeStorageCacheProvider;
|
||||
use Psalm\Internal\Provider\FileProvider;
|
||||
@ -218,10 +218,16 @@ final class Psalter
|
||||
static fn(): ?\Composer\Autoload\ClassLoader =>
|
||||
CliUtils::requireAutoloaders($current_dir, isset($options['r']), $vendor_dir)
|
||||
);
|
||||
|
||||
$ini_handler = new PsalmRestarter('PSALTER');
|
||||
$ini_handler->disableExtensions([
|
||||
'grpc',
|
||||
'uopz',
|
||||
'pcov',
|
||||
'blackfire',
|
||||
]);
|
||||
|
||||
// If Xdebug is enabled, restart without it
|
||||
(new XdebugHandler('PSALTER'))->check();
|
||||
$ini_handler->check();
|
||||
|
||||
$paths_to_check = CliUtils::getPathsToCheck($options['f'] ?? null);
|
||||
|
||||
|
@ -5,6 +5,7 @@ namespace Psalm\Internal\Fork;
|
||||
use Composer\XdebugHandler\XdebugHandler;
|
||||
|
||||
use function array_filter;
|
||||
use function array_merge;
|
||||
use function array_splice;
|
||||
use function extension_loaded;
|
||||
use function file_get_contents;
|
||||
@ -26,11 +27,17 @@ class PsalmRestarter extends XdebugHandler
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private array $disabledExtensions = [];
|
||||
private array $disabled_extensions = [];
|
||||
|
||||
public function disableExtension(string $disabledExtension): void
|
||||
public function disableExtension(string $disabled_extension): void
|
||||
{
|
||||
$this->disabledExtensions[] = $disabledExtension;
|
||||
$this->disabled_extensions[] = $disabled_extension;
|
||||
}
|
||||
|
||||
/** @param list<non-empty-string> $disable_extensions */
|
||||
public function disableExtensions(array $disable_extensions): void
|
||||
{
|
||||
$this->disabled_extensions = array_merge($this->disabled_extensions, $disable_extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,7 +49,7 @@ class PsalmRestarter extends XdebugHandler
|
||||
protected function requiresRestart($default): bool
|
||||
{
|
||||
$this->required = (bool) array_filter(
|
||||
$this->disabledExtensions,
|
||||
$this->disabled_extensions,
|
||||
static fn(string $extension): bool => extension_loaded($extension)
|
||||
);
|
||||
|
||||
@ -72,7 +79,7 @@ class PsalmRestarter extends XdebugHandler
|
||||
protected function restart(array $command): void
|
||||
{
|
||||
if ($this->required && $this->tmpIni) {
|
||||
$regex = '/^\s*(extension\s*=.*(' . implode('|', $this->disabledExtensions) . ').*)$/mi';
|
||||
$regex = '/^\s*(extension\s*=.*(' . implode('|', $this->disabled_extensions) . ').*)$/mi';
|
||||
$content = file_get_contents($this->tmpIni);
|
||||
|
||||
$content = preg_replace($regex, ';$1', $content);
|
||||
|
Loading…
Reference in New Issue
Block a user