pub fn replace_words(
catalog: &Catalog,
run: &[String],
runner: &[String],
left: &str,
package: &Version,
) -> Option<Vec<String>>Expand description
The words that write left again with --force, if Mortise knows the
generator that wrote it. run holds the words of the run that left the file.
- A generator that writes one file: the run’s words and
--force. module:make-model: the file name is compared with the names the model passes to its calls. A match gives that call with--force. The model’s own file gives the run’s words without the seven flags and--all, with--force. Before 13.4--factorystays when the run made the factory, as the model’s stub uses it, and the factory call leaves its file. From 13.4 on the model passes--forceto its calls (package PR #2302), so--factorywould write over the factory too, and without it the stub losesHasFactory: a run with--factoryor--allgetsNone. A run without them writes only the model’s file.- A migration,
module:make-componentandmodule:make:None. A migration gets a new date in its file name, so--forcewould not write the same file. - A generator the package does not ship (an app’s own):
None. It may call another generator and pass--forceon, so it could write over more thanleft.
These are names the package passes, not paths: the generator writes where the package says.
runner holds the option words of the runner’s own line, before a -- (a
Custom line php artisan --policy gives --policy). They go with every command,
and a replacement cannot take them out: they count as options of the run. From
13.4 on, a runner word that sets any option of module:make-model but --json
gives the model’s own file None, as the model would pass --force on to a call.
package is the app’s package version.