Skip to content

Commit

Permalink
Add --use-ini-defaults arg to prevent Psalm overriding memory_limit a…
Browse files Browse the repository at this point in the history
…nd more

Fixes #842
  • Loading branch information
muglug committed Jun 27, 2018
1 parent 72b110a commit 4a97588
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/psalm.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

// show all errors
error_reporting(-1);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('memory_limit', '4096M');

// get options from command line
$options = getopt(
Expand All @@ -18,10 +15,16 @@
'help', 'debug', 'debug-by-line', 'config:', 'monochrome', 'show-info:', 'diff',
'output-format:', 'report:', 'find-dead-code', 'init',
'find-references-to:', 'root:', 'threads:', 'clear-cache', 'no-cache',
'version', 'plugin:', 'stats', 'show-snippet:',
'version', 'plugin:', 'stats', 'show-snippet:', 'use-ini-defaults',
]
);

if (!array_key_exists('use-ini-defaults', $options)) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('memory_limit', '4096M');
}

if (array_key_exists('help', $options)) {
$options['h'] = false;
}
Expand Down Expand Up @@ -116,6 +119,9 @@
--stats
Shows a breakdown of Psalm's ability to infer types in the codebase
--use-ini-defaults
Use PHP-provided ini defaults for memory and error display
HELP;

exit;
Expand Down

0 comments on commit 4a97588

Please sign in to comment.