When analyzing complex files the `phpcs` can eat lots of memory and this ends up in following `arc lint` output (when `.arclint` is using `phpcs` linter):
```
Some linters failed:
- CommandException: Command failed with error #255!
COMMAND
'phpcs' '--report=xml' '--standard=vendor/aik099/coding-standard/CodingStandard' '/path/to/analyzed/file.php'
STDOUT
(empty)
STDERR
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /home/user/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php on line 335
PHP Stack trace:
PHP 1. {main}() /home/user/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcs:0
PHP 2. PHP_CodeSniffer_CLI->runphpcs() /home/user/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcs:25
PHP 3. PHP_CodeSniffer_CLI->process($values = *uninitialized*) /home/user/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php:95
PHP 4. PHP_CodeSniffer->processFiles($files = array (0 => '/home/user/web/p/rpierp/modules/custom/units/sections/e_order_eh.php'), $local = FALSE) /home/user/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php:855
PHP 5. PHP_CodeSniffer->processFile($file = '/home/user/web/p/rpierp/modules/custom/units/sections/e_order_eh.php', $contents = N... (9,915 more bytes) ...
(Run with `--trace` for a full exception trace.)
```
To solve this I propose to lift memory limit, when running PHP_CodeSniffer through using `-d` option, that it supports.
The `ArcanistPhpcsLinter::getMandatoryFlags` method before:
```
lang=php
protected function getMandatoryFlags() {
$options = array('--report=xml');
if ($this->standard) {
$options[] = '--standard='.$this->standard;
}
return $options;
}
```
The `ArcanistPhpcsLinter::getMandatoryFlags` method after:
```
lang=php
protected function getMandatoryFlags() {
$options = array('--report=xml', '-d', 'memory_limit=-1');
if ($this->standard) {
$options[] = '--standard='.$this->standard;
}
return $options;
}
```