Optionally bypass the memory limit for PHPCS in the core commit check script

Created on 25 July 2025, 13 days ago

Problem/Motivation

πŸ“Œ Set memory limit to -1 for phpstan precommit hooks Active added a useful setting to the core linting script that allows PHPStan to optionally use unlimited memory. This is especially useful for committer pre-commit checks, which run the script without calling it manually.

PHPCS also can OOM in the same way in the same script, so the same fix can also be applied to PHPCS:

The PHP_CodeSniffer "phpcs" command ran out of memory.
Either raise the "memory_limit" of PHP in the php.ini file or raise the memory limit at runtime
using `phpcs -d memory_limit=512M` (replace 512M with the desired memory limit).

Steps to reproduce

  • Set php.ini to a relatively low memory limit (e.g. 128 or 256 MB).
  • Make a change to core/phpcs.xml.dist.
  • Run:
    bash ./core/scripts/dev/commit-code-check.sh
    

Proposed resolution

Extend the flag added in πŸ“Œ Set memory limit to -1 for phpstan precommit hooks Active to also bypass the memory limit for PHPCS.

Remaining tasks

Needs patch and manual testing.
Followup needed for the committer toolchain.

User interface changes

N/A

Introduced terminology

None.

API changes

Should be none.

Data model changes

None.

Release notes snippet

Not needed.

πŸ“Œ Task
Status

Postponed

Version

11.0 πŸ”₯

Component

other

Created by

πŸ‡ΊπŸ‡ΈUnited States xjm

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024