Skip to content

Commit 8a183c4

Browse files
committed
Place attributes after phpdoc blocks.
1 parent 293ec64 commit 8a183c4

File tree

25 files changed

+121
-337
lines changed

25 files changed

+121
-337
lines changed

docs/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ This change log references the repository changes and releases, which respect [s
150150
1. Added `executeBuiltInSubcommandIfRequested()` method for built-in subcommands automatic execution;
151151
the method is utilized by `Parametizer::run()`.
152152
1. Added `CliRequestProcessor::parseSubcommandParameters()` protected method
153-
to ease processing of the default subcommand switch value.
153+
to ease processing of the default subcommand name (subcommand switch value).
154154
1. Added `CliRequestProcessor::$isForCompletion` readonly flag (settable in `__construct()`). The flag is used
155155
to stabilize completion output due to the default subcommand switch value.
156156
1. [Config.php](../src/Parametizer/Config/Config.php):

docs/development-notes.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [CliToolkit](../README.md) -> Development notes
22

3+
Added here mainly for the library maintainers - not to forget decisions made to arguable cases.
4+
35
## Contents
46

57
- [PHPUnit](#phpunit)
@@ -10,6 +12,8 @@
1012
- [EnvironmentConfig load performance](#environmentconfig-load-performance)
1113
- [RegExp in subcommand name validation](#regexp-in-subcommand-name-validation)
1214
- [Throwing or ignoring exceptions default policy](#throwing-or-ignoring-exceptions-default-policy)
15+
- [Simplifying chain calls](#simplifying-chain-calls)
16+
- [Parametizer::newConfig()](#parametizernewconfig)
1317

1418
## PHPUnit
1519

@@ -147,3 +151,16 @@ The current policy:
147151
* Even if the library users do not read the documentation, at the first time they read a generated launcher script,
148152
they will know about a possibility to silence (or enable) exceptions. And then users decide if they prefer
149153
a zero-bug or production-safe setup.
154+
155+
## Simplifying chain calls
156+
157+
### `Parametizer::newConfig()`
158+
159+
**Hypothesis**: `EnvironmentConfig` might be automatically created right in `Parametizer::newConfig()`, before
160+
internal calls in the stack reach `Config::__construct()`. Thus, `$throwOnException` parameter, needed (for now) only
161+
for `EnvironmentConfig` automatic creation, may be stripped off in the call stack - only `Parametizer::newConfig()`
162+
should keep this parameter, and `Config` then will require an env config instance only (no extra flag).
163+
164+
**Decision**: this simplification should _not_ be implemented. From the development perspective, it changes
165+
almost nothing - almost no calls become easier in 95% of cases, if the methods' signatures are simplified.
166+
Because in 95% of cases `Parametizer::newConfig()` is called, not the inner methods along the stack.

docs/features-manual.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Here are more detailed descriptions for different features you may find in the p
55
## Contents
66

77
- [Classes or plain scripts](#classes-or-plain-scripts)
8-
- [Class detection performance](#class-detection-performance)
8+
- [Class detection performance](#class-detection-and-performance)
99
- [Class scripts alternative launcher](#class-scripts-alternative-launcher)
1010
- [Parameter types](#parameter-types)
1111
- [Type casting from requests](#type-casting-from-requests)
@@ -79,8 +79,8 @@ aspects of developing a console script with this library:
7979
* _Class-based_: Just create a class-based script.
8080
* Generally, your launcher's detector will detect the new class automatically.
8181
Otherwise, update the detection rules in the launcher.
82-
* In case of [caching detected class names](#class-detection-performance), you should re-create the cache file:
83-
`php your-launcher.php script-launcher:clear-cache`
82+
* In case of [caching detected class names](#class-detection-and-performance), you should re-create the cache
83+
file: `php your-launcher.php script-launcher:clear-cache`
8484
* **Naming and grouping scripts**:
8585
* _Plain_: Placing scripts in different directories is your main option.
8686
* If you enable completion, then you may group your scripts by alias prefixes: generate completion scripts for
@@ -95,7 +95,7 @@ aspects of developing a console script with this library:
9595
detection rules to access a selected subset of scripts.
9696
</details>
9797

98-
### Class detection performance
98+
### Class detection and performance
9999

100100
`ScriptClassDetector` provides you with these ways (non-exclusive) to set detection rules:
101101

@@ -106,7 +106,7 @@ aspects of developing a console script with this library:
106106
* User-friendly: pretty much - in trivial cases (all scripts are within a single directory or its subdirectories)
107107
it is enough to specify just a single directory.
108108
* Use case: in most cases this method covers your needs.
109-
1. `excludeDirectory()` allows you to filter out a directory that definitely should not be parsed. Obviously,
109+
2. `excludeDirectory()` allows you to filter out a directory that definitely should not be parsed. Obviously,
110110
this method works well only when paired with `searchDirectory()` method in the recursive mode.
111111
* Use case: the directory specified in `searchDirectory()` contains subdirectories that definitely do not contain
112112
console scripts. So you can improve the detection performance by filtering out non-relevant subpaths.
@@ -117,6 +117,12 @@ aspects of developing a console script with this library:
117117
* Use cases:
118118
* Cherry-picking particular scripts.
119119
* Improving detection performance (instead of pointing at a directory with thousands of files).
120+
4. Though not a part of `ScriptClassDetector` setup, there is a way to mark a class script ignored by all class
121+
detectors: redefine `ScriptClassAbstract::isAvailableByDetector()` method for your particular script and make it
122+
return `false` if you do not want that script to be detectable.
123+
124+
Do note however, that the detector's `scriptClassName()` method does _not_ consider
125+
`ScriptClassAbstract::isAvailableByDetector()` and thus still allows to cherry-pick otherwise ignored scripts.
120126

121127
Now consider an odd case. You have a large project (gigabytes / tens of thousands of files), but your console scripts
122128
are scattered throughout your whole project for some reason - for instance, each console script is placed close to

0 commit comments

Comments
 (0)