1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 13:51:54 +01:00

Fix falsable issues with ini_get/getopt

This commit is contained in:
robchett 2023-10-09 22:15:22 +01:00
parent 276a25de92
commit f62fd826a2
4 changed files with 8 additions and 2 deletions

View File

@ -104,6 +104,9 @@ final class Psalter
// get options from command line
$options = getopt(implode('', self::SHORT_OPTIONS), self::LONG_OPTIONS);
if ($options === false) {
die('Failed to parse cli options' . PHP_EOL);
}
self::validateCliArguments($args);

View File

@ -85,6 +85,9 @@ final class Refactor
// get options from command line
$options = getopt(implode('', $valid_short_options), $valid_long_options);
if ($options === false) {
die('Failed to parse cli options' . PHP_EOL);
}
array_map(
static function (string $arg) use ($valid_long_options): void {

View File

@ -134,7 +134,7 @@ class Pool
exit(1);
}
$disabled_functions = array_map('trim', explode(',', ini_get('disable_functions')));
$disabled_functions = array_map('trim', explode(',', (string) ini_get('disable_functions')));
if (in_array('pcntl_fork', $disabled_functions)) {
echo "pcntl_fork() is disabled by php configuration (disable_functions directive).\n"
. "Please enable it or run Psalm single-threaded with --threads=1 cli switch.\n";

View File

@ -74,7 +74,7 @@ class PsalmRestarter extends XdebugHandler
'log_verbosity_level' => (int) ini_get('opcache.log_verbosity_level'),
'optimization_level' => (string) ini_get('opcache.optimization_level'),
'preload' => (string) ini_get('opcache.preload'),
'jit_buffer_size' => self::toBytes(ini_get('opcache.jit_buffer_size')),
'jit_buffer_size' => self::toBytes((string) ini_get('opcache.jit_buffer_size')),
];
foreach (self::REQUIRED_OPCACHE_SETTINGS as $ini_name => $required_value) {