PHPCompatibility / PHPCompatibilityWP

PHPCompatibility ruleset for WordPress projects
GNU Lesser General Public License v3.0
171 stars 10 forks source link

Fatal Error: Allowed Memory Size of 134217728 bytes exhausted #25

Closed metalandcoffee closed 3 years ago

metalandcoffee commented 3 years ago

Hi there 👋🏾

When I run phpcs -p wordpress-plugin --standard=PHPCompatibilityWP --runtime-set testVersion 7.3- --extensions=php, I get the following error:

......................W...W............
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /.composer/vendor/squizlabs/php_codesniffer/src/Tokenizers/Tokenizer.php on line 1504

The file that it is stopping at (when I add the -v flag) is 25,000 lines long. Could this be why?

jrfnl commented 3 years ago

Well, yes, that wouldn't surprise me at all. Depending on how complex (and long) the file is, the tokenization can take up quite some memory.

You could try raising the memory_limit in the php.ini file used by the process.

metalandcoffee commented 3 years ago

Thanks @jrfnl - I'll do that. Just wanted to double check :)

jrfnl commented 3 years ago

No problem. Hope it fixes the issue for you.

vialjoris commented 3 years ago

phpcs -d memory_limit=512M -p wordpress-plugin --standard=PHPCompatibilityWP --runtime-set testVersion 7.3- --extensions=php