Skip to content

Commit f8725b8

Browse files
committed
Refactor Builder
- Rename `getClassName()` to `getService()` - Replace overloaded methods with declared ones: - `build()` - `resolve()` - `get()` - `isset()` - `go()` - Split `HasBuilder` **interface** into `ReturnsBuilder`, `ResolvesBuilder` and others - Add `HasBuilder` **trait** to simplify builder servicing - Update "lk-util generate builder" command - Allow properties to be excluded from "lk-util generate builder" output - Allow methods to be forwarded from a builder to a new instance without calling `$builder->go()` first - Rename `Builder::get()` to `getB()` and `isset()` to `issetB()` so instance methods with these names can be surfaced - Adopt method forwarding for `CurlerBuilder` Also: - Make both callbacks in `IFluentInterface::if()` optional [no ci]
1 parent 88ca168 commit f8725b8

30 files changed

+820
-504
lines changed

lib/lk-util/Command/Generate/Concept/GenerateCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ abstract class GenerateCommand extends Command
3636
protected const VISIBILITY_PUBLIC = 'public';
3737
protected const VISIBILITY_PROTECTED = 'protected';
3838
protected const VISIBILITY_PRIVATE = 'private';
39-
40-
private const TAB = ' ';
39+
protected const TAB = ' ';
4140

4241
protected ?string $OutputDescription;
4342
protected ?bool $ToStdout;
@@ -482,11 +481,12 @@ protected function generateGetter(
482481
string $name,
483482
string $valueCode,
484483
$phpDoc = '@internal',
485-
string $returnType = 'string'
484+
string $returnType = 'string',
485+
string $visibility = GenerateCommand::VISIBILITY_PROTECTED
486486
): array {
487487
$lines = [
488488
...$this->generatePhpDocBlock($phpDoc),
489-
sprintf('protected static function %s(): %s', $name, $returnType),
489+
sprintf('%s static function %s(): %s', $visibility, $name, $returnType),
490490
'{',
491491
sprintf('%sreturn %s;', self::TAB, $valueCode),
492492
'}'

0 commit comments

Comments
 (0)