WriteGuard
Filesystem safety for generators: refuses to clobber an existing file unless `--force`, and creates parent directories on write. `assertWritable()` is called for every planned file up front so a blocked target aborts the whole `coa:make` run before anything is written.
WriteGuard::assertWritable()
public function assertWritable(string $path, bool $force, bool $merge = false): voidThrows unless `$path` is free to write: absent, `$force` is true, or `$merge` is true.
Parameters
| Name | Type | Description |
|---|---|---|
| $path | string | |
| $force | bool | |
| $merge | bool | Set from the originating {@see PlannedFile::$merge} — a MARKER-BASED, idempotent-safe merge into an already-existing plugin file (see {@see MarkerInserter}) is exactly the "safe to overwrite even without * `--force`" case this guard exists to distinguish from an accidental clobber of unrelated hand-written content. |
WriteGuard::write()
public function write(string $path, string $contents): voidWrites `$contents` to `$path`, creating parent directories as needed.
Parameters
| Name | Type | Description |
|---|---|---|
| $path | string | |
| $contents | string |