Change values of one class's configuration in a PHP file -- the \MMO\config([...]) a project's scripts/bootstrap.php holds -- where they are written, leaving the rest of the file as a person wrote it.
class MMO\admin\helpers\PhpConfigEditor
Namespace
MMO\admin\helpers
The file is code someone reads: its comments say why each value is what it is. So nothing is regenerated.
PHP's own tokenizer finds `Class::class => [ ... ]`, then `'key' => <expression>` directly inside it, and only
that expression is replaced, by the new value written as PHP. A key the array does not have yet is added
after its last one.
It does not run the file, so it cannot tell what an expression evaluates to: the current values are the ones
the running configuration holds. Lint what it returns (`php -l`) before writing it.
$php = new PhpConfigEditor(\MMO\core\files\get('scripts/bootstrap.php'), ProductionController::class);
$php->set('postInstall', null);
$php->set('buildCommands', ['php scripts/build-theme.php all --prod']);
\MMO\core\files\set('scripts/bootstrap.php', $php->getCode());
int, 1: int, 2: string, 3: int|null}|null where the class's array opens and closes, the indentation of its entries, and where its last meaningful token ends (null for an empty array).