Skip to content
docsv0.44.3

StubLocator

Where a stub is read from: the app's `stubs/` first, the package's own second. The generators ship their templates under this package; an app that wants `make` to write its own conventions (a header, a base class, a docblock style) copies a stub to `<root>/stubs/<name>` and edits it — `stubs:publish` does the copying — and from then on that file wins for that ONE stub while every other keeps coming from the package (greenhouse decisions/0216, point 6). A name that exists in neither place is refused by name, not read as an empty template.

StubLocator::__construct()

public function __construct(string $package = '/home/runner/work/devtools/devtools/src/Make/stubs', ?string $app = null):

Parameters

Parameters of __construct()
NameTypeDescription
$packagestring
$app?string

StubLocator::at()

public function at(string $root): self

The locator bound to an app root: `<root>/stubs/` is consulted before the package.

Parameters

Parameters of at()
NameTypeDescription
$rootstring

StubLocator::path()

public function path(string $name): string

The file to render for `$name` — the app's copy when it has one, the package's otherwise.

Parameters

Parameters of path()
NameTypeDescription
$namestring

StubLocator::names()

public function names(): array

Every stub the package ships, by name, sorted.

StubLocator::package()

public function package(): string

The package's stub directory.