ReapplyService
API reference › Scaffold › Services › ReapplyService
Rewrites tracked files from their provider stubs; without force it merges append and prepend files and skips
ejected, adopted, user-modified and existing preserve files; it always skips orphaned files.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
run() | Reapplies the tracked files that match the filters and records their new hashes in scaffold-lock.json, or only prints what would change with $dryRun, ending with a summary line. | ReapplyService |
Method details
Section titled “Method details”run()
Section titled “run() ”public function run(PHPForge\Scaffold\Config\ProjectContext $context, PHPForge\Scaffold\Console\OutputWriter $out, string $file = '', string $provider = '', bool $force = false, bool $dryRun = false, bool $exitCode = false): intReapplies the tracked files that match the filters and records their new hashes in scaffold-lock.json, or only
prints what would change with $dryRun, ending with a summary line.
Parameters
| Parameter | Type | Description |
|---|---|---|
$context | PHPForge\ | Project to reapply. |
$out | PHPForge\ | Output sink. |
$file | string | Destination path to reapply, or an empty string for every tracked file. |
$provider | string | Provider package name to reapply, or an empty string for every provider. |
$force | bool | Whether to overwrite every matching file with its stub, including ejected, adopted, user-modified, preserve, append and prepend files, and to clear the ejected and adopted flags. |
$dryRun | bool | Whether to print the diff of every file that would change instead of writing anything. |
$exitCode | bool | Whether a dry run returns 1 when any file would change. |
Returns
int: 1 when a filter matches no tracked file or an entry was skipped for an error (unsafe entry, provider not allowed, missing stub, unknown mode, read, hash or write failure), or with $dryRun and $exitCode when any file would change; 0 otherwise, including user-modified, preserve, ejected and orphaned skips.
Throws
RuntimeException: when the lock file cannot be read or written.