Skip to content

Commit 65aa915

Browse files
[cache] Standardize cache contract across commands (#162) (#170)
* [cache] Standardize cache contract across commands (#162) * Update wiki submodule pointer for PR #170 * [tests] Add missing coverage metadata for standards command (#162) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 82eec9c commit 65aa915

23 files changed

Lines changed: 660 additions & 52 deletions

.github/wiki

Submodule wiki updated from af0d173 to edc39f1

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Changed
1111

1212
- Require GitHub issue write readback verification in the github-issues skill (#165)
13+
- Standardize cache flags and nested cache-dir propagation across cache-aware commands (#162)
1314

1415
## [1.18.0] - 2026-04-23
1516

docs/commands/docs.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ Options
4242
Path to the cache directory for phpDocumentor.
4343
Default: ``.dev-tools/cache/phpdoc``.
4444

45+
``--cache``
46+
Force phpDocumentor caching on for this run.
47+
48+
``--no-cache``
49+
Force phpDocumentor caching off for this run.
50+
4551
``--progress``
4652
Enable progress output from phpDocumentor.
4753

@@ -73,6 +79,12 @@ Use custom source:
7379
7480
composer docs --source=docs/user-guide
7581
82+
Generate without cache:
83+
84+
.. code-block:: bash
85+
86+
composer docs --no-cache
87+
7688
Exit Codes
7789
---------
7890

@@ -92,7 +104,12 @@ Behavior
92104
- ``docs/`` must exist unless you pass another ``--source`` directory.
93105
- API pages are built from the PSR-4 paths declared in ``composer.json``.
94106
- Guide pages are built from the selected source directory.
95-
- A temporary ``phpdocumentor.xml`` is created in the cache directory.
107+
- Cache stays enabled by default; omit both flags to keep the command default,
108+
pass ``--cache`` to force it on, and pass ``--no-cache`` to force it off.
109+
- When ``--cache-dir`` is omitted, phpDocumentor keeps its default cache
110+
directory. The option only affects phpDocumentor when caching is enabled.
111+
- A temporary ``phpdocumentor.xml`` is created for the run and uses the
112+
configured cache directory only when caching stays enabled.
96113
- Progress output is disabled by default; use ``--progress`` to re-enable it in
97114
text mode.
98115
- ``--json`` and ``--pretty-json`` suppress phpDocumentor progress rendering so

docs/commands/phpdoc.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ Options
3838
``--cache-dir`` (optional)
3939
Path to the cache directory for PHP-CS-Fixer. Default: ``.dev-tools/cache/php-cs-fixer``.
4040

41+
``--cache``
42+
Force PHP-CS-Fixer caching on for this run.
43+
44+
``--no-cache``
45+
Force PHP-CS-Fixer caching off for this run.
46+
4147
``--progress``
4248
Enable progress output from PHP-CS-Fixer and the Rector phase.
4349

@@ -69,6 +75,12 @@ Check specific directory:
6975
7076
composer phpdoc ./src
7177
78+
Check without cache:
79+
80+
.. code-block:: bash
81+
82+
composer phpdoc --no-cache
83+
7284
Exit Codes
7385
---------
7486

@@ -88,6 +100,10 @@ Behavior
88100
- Creates ``.docheader`` from the packaged template when the file is missing.
89101
- Uses ``.php-cs-fixer.dist.php`` and ``rector.php`` through local-first fallback.
90102
- The Rector phase explicitly runs ``FastForward\DevTools\Rector\AddMissingMethodPhpDocRector``.
103+
- Cache stays enabled by default; omit both flags to keep the command default,
104+
pass ``--cache`` to force it on, and pass ``--no-cache`` to force it off.
105+
- When ``--cache-dir`` is omitted, PHP-CS-Fixer keeps its default cache
106+
directory. The option only affects PHP-CS-Fixer when caching is enabled.
91107
- Progress output is disabled by default; use ``--progress`` to re-enable it in
92108
text mode.
93109
- ``--json`` and ``--pretty-json`` forward JSON mode to PHP-CS-Fixer and

docs/commands/reports.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ Options
4040
The target directory for the generated metrics report.
4141
Default: ``.dev-tools/metrics``.
4242

43+
``--cache-dir`` (optional)
44+
Base cache directory for nested ``docs`` and ``tests`` caches.
45+
When omitted, each nested tool keeps its own default cache directory.
46+
47+
``--cache``
48+
Force cache-aware nested documentation and test steps to keep caching enabled.
49+
50+
``--no-cache``
51+
Force cache-aware nested documentation and test steps to disable caching.
52+
4353
``--progress``
4454
Enable progress output in nested ``docs``, ``tests``, and ``metrics`` steps.
4555

@@ -71,6 +81,12 @@ Generate reports with a custom metrics directory:
7181
7282
composer reports --metrics=.dev-tools/metrics
7383
84+
Generate reports with cache disabled for nested docs and tests:
85+
86+
.. code-block:: bash
87+
88+
composer reports --no-cache
89+
7490
Exit Codes
7591
---------
7692

@@ -89,6 +105,14 @@ Behavior
89105

90106
- Runs ``docs`` in parallel with ``tests --coverage``.
91107
- Runs ``metrics --target`` after tests so the JUnit report is available.
108+
- Cache stays enabled by default for nested cache-aware steps; omit both flags
109+
to keep the command default, pass ``--cache`` to force it on, and pass
110+
``--no-cache`` to force it off.
111+
- The explicit cache intent is propagated to the nested ``docs`` and ``tests``
112+
steps. The ``metrics`` step does not consume this contract.
113+
- When ``--cache-dir`` is provided, ``docs`` and ``tests`` receive nested cache
114+
directories under that base path. When it is omitted, each nested tool keeps
115+
its own default cache directory.
92116
- Runs tests with progress disabled by default and ``--coverage-summary`` so
93117
report builds keep PHPUnit output concise.
94118
- Progress output stays disabled by default across nested steps; use

docs/commands/standards.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Options
3535

3636
This command supports:
3737

38+
- ``--cache-dir`` to provide a base cache directory for nested cache-aware
39+
phases;
40+
- ``--cache`` to force cache-aware nested phases to keep caching enabled;
41+
- ``--no-cache`` to force cache-aware nested phases to disable caching;
3842
- ``--progress`` to re-enable progress output from the nested phases in text
3943
mode;
4044
- ``--json`` to emit a structured machine-readable payload instead of the
@@ -61,6 +65,15 @@ Behavior
6165
- This is the default command when running ``composer dev-tools`` without args.
6266
- Each phase runs in sequence; if any phase fails, the command returns failure.
6367
- The ``--fix`` option is passed to all phases that support it.
68+
- Cache stays enabled by default for nested cache-aware phases; omit both flags
69+
to keep the command default, pass ``--cache`` to force it on, and pass
70+
``--no-cache`` to force it off.
71+
- The explicit cache intent is propagated to the nested ``phpdoc`` and
72+
``reports`` phases. ``refactor`` and ``code-style`` do not consume this
73+
contract.
74+
- When ``--cache-dir`` is provided, ``phpdoc`` and ``reports`` receive nested
75+
cache directories under that base path. When it is omitted, each nested tool
76+
keeps its own default cache directory.
6477
- Progress output is disabled by default across nested phases; use
6578
``--progress`` to re-enable it in text mode.
6679
- ``--json`` and ``--pretty-json`` are forwarded through every phase so the

docs/commands/tests.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ Options
4141
``--cache-dir`` (optional)
4242
Path to the PHPUnit cache directory. Default: ``.dev-tools/cache/phpunit``.
4343

44+
``--cache``
45+
Force PHPUnit result caching on for this run.
46+
4447
``--no-cache``
45-
Disable PHPUnit caching.
48+
Force PHPUnit result caching off for this run.
4649

4750
``--progress``
4851
Enable PHPUnit progress output.
@@ -114,6 +117,12 @@ Run without cache:
114117
115118
composer tests --no-cache
116119
120+
Force cache on explicitly:
121+
122+
.. code-block:: bash
123+
124+
composer tests --cache
125+
117126
Run with PHPUnit progress output enabled:
118127

119128
.. code-block:: bash
@@ -141,6 +150,10 @@ Behavior
141150
- Local ``phpunit.xml`` is preferred over the packaged default.
142151
- Coverage filters are automatically applied to all PSR-4 paths from composer.json.
143152
- Multiple coverage formats are generated: HTML, Testdox HTML, Clover XML, and PHP.
153+
- Cache stays enabled by default; omit both flags to keep the command default,
154+
pass ``--cache`` to force it on, and pass ``--no-cache`` to force it off.
155+
- When ``--cache-dir`` is omitted, PHPUnit keeps its default cache directory.
156+
The option only affects the result cache when caching is enabled.
144157
- ``--coverage-summary`` forwards PHPUnit's ``--only-summary-for-coverage-text``
145158
only when coverage text output is generated.
146159
- progress output is disabled by default.

docs/commands/wiki.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ Options
2929
Path to the cache directory for phpDocumentor.
3030
Default: ``.dev-tools/cache/phpdoc``.
3131

32+
``--cache``
33+
Force phpDocumentor caching on for this run.
34+
35+
``--no-cache``
36+
Force phpDocumentor caching off for this run.
37+
3238
``--init``
3339
Initialize the configured wiki target as a Git submodule.
3440

@@ -60,6 +66,12 @@ Initialize wiki as submodule:
6066
6167
composer wiki --init
6268
69+
Generate without cache:
70+
71+
.. code-block:: bash
72+
73+
composer wiki --no-cache
74+
6375
Exit Codes
6476
---------
6577

@@ -77,5 +89,9 @@ Behavior
7789
---------
7890

7991
- Default output directory is ``.github/wiki``.
92+
- Cache stays enabled by default; omit both flags to keep the command default,
93+
pass ``--cache`` to force it on, and pass ``--no-cache`` to force it off.
94+
- When ``--cache-dir`` is omitted, phpDocumentor keeps its default cache
95+
directory. The option only affects phpDocumentor when caching is enabled.
8096
- Uses the Markdown template from ``vendor/saggre/phpdocumentor-markdown/themes/markdown``.
8197
- The ``--init`` option creates the wiki as a Git submodule pointing to the repository wiki.

docs/running/specialized-commands.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,14 @@ Important details:
5555
- local ``phpunit.xml`` is preferred over the packaged default;
5656
- ``--coverage=<path>`` creates HTML, Testdox, Clover, and raw coverage output;
5757
- ``--coverage-summary`` keeps coverage text output to PHPUnit's summary;
58+
- cache stays enabled by default; ``--cache`` forces it on and ``--no-cache``
59+
forces it off for a single run;
60+
- when ``--cache-dir`` is omitted, PHPUnit keeps its default cache directory;
61+
- ``--cache-dir`` only affects PHPUnit's result cache when caching is enabled;
5862
- progress output is disabled by default;
5963
- ``--progress`` re-enables PHPUnit progress output in text mode;
6064
- ``--json`` and ``--pretty-json`` still suppress PHPUnit progress output
6165
automatically;
62-
- ``--no-cache`` disables ``.dev-tools/cache/phpunit``;
6366
- the packaged configuration registers the DevTools PHPUnit extension.
6467

6568
``dependencies``
@@ -184,6 +187,10 @@ Important details:
184187
local-first fallback logic;
185188
- the Rector phase explicitly runs
186189
``FastForward\DevTools\Rector\AddMissingMethodPhpDocRector``;
190+
- cache stays enabled by default; ``--cache`` forces it on and ``--no-cache``
191+
forces it off for the PHP-CS-Fixer phase;
192+
- when ``--cache-dir`` is omitted, PHP-CS-Fixer keeps its default cache directory;
193+
- ``--cache-dir`` only affects PHP-CS-Fixer when caching is enabled;
187194
- progress output is disabled by default; ``--progress`` re-enables it for text
188195
mode;
189196
- ``--json`` and ``--pretty-json`` switch PHP-CS-Fixer to JSON output with
@@ -206,6 +213,10 @@ Important details:
206213
- guide pages are built from the selected source directory;
207214
- ``--template`` defaults to
208215
``vendor/fast-forward/phpdoc-bootstrap-template``;
216+
- cache stays enabled by default; ``--cache`` forces it on and ``--no-cache``
217+
forces it off for a single run;
218+
- when ``--cache-dir`` is omitted, phpDocumentor keeps its default cache directory;
219+
- ``--cache-dir`` only affects phpDocumentor when caching is enabled;
209220
- progress output is disabled by default; ``--progress`` re-enables it for text
210221
mode;
211222
- ``--json`` and ``--pretty-json`` also disable phpDocumentor's progress output.
@@ -224,6 +235,10 @@ Important details:
224235
- the default output directory is ``.github/wiki``;
225236
- it uses the Markdown template from
226237
``vendor/saggre/phpdocumentor-markdown/themes/markdown``;
238+
- cache stays enabled by default; ``--cache`` forces it on and ``--no-cache``
239+
forces it off for a single run;
240+
- when ``--cache-dir`` is omitted, phpDocumentor keeps its default cache directory;
241+
- ``--cache-dir`` only affects phpDocumentor when caching is enabled;
227242
- it is especially useful together with the reusable wiki workflow.
228243

229244
``reports``
@@ -242,6 +257,10 @@ Important details:
242257
- it calls ``metrics --target .dev-tools/metrics --junit .dev-tools/coverage/junit.xml``;
243258
- ``docs`` remains detached, while ``tests`` and ``metrics`` run in sequence so
244259
PhpMetrics can reuse the JUnit report generated by PHPUnit;
260+
- cache stays enabled by default for the nested ``docs`` and ``tests`` steps;
261+
``--cache`` forces that explicit intent on and ``--no-cache`` forces it off;
262+
- when ``--cache-dir`` is omitted, nested tools keep their own default cache
263+
directories;
245264
- progress output stays disabled by default across the nested steps, and
246265
``--progress`` re-enables it for human-readable runs;
247266
- ``--json`` and ``--pretty-json`` are propagated to each subprocess, while

docs/usage/testing-and-coverage.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ When you run ``tests``, DevTools:
1212
- resolves ``phpunit.xml`` from the consumer root first and falls back to the
1313
packaged default;
1414
- uses ``vendor/autoload.php`` as the default bootstrap file;
15-
- stores cache data in ``.dev-tools/cache/phpunit`` unless ``--no-cache`` is used;
15+
- keeps PHPUnit result caching enabled by default;
16+
- treats ``--cache`` as an explicit force-on flag and ``--no-cache`` as an
17+
explicit force-off flag for the current run;
18+
- uses ``.dev-tools/cache/phpunit`` only when caching stays enabled;
1619
- can generate HTML coverage, Testdox, Clover, and raw PHP coverage output
1720
when ``--coverage`` is provided.
1821

@@ -23,8 +26,8 @@ Useful Examples
2326
2427
composer tests
2528
composer tests -- --filter=PluginTest
26-
vendor/bin/dev-tools tests --coverage=.dev-tools/coverage
27-
vendor/bin/dev-tools tests --no-cache --bootstrap=tests/bootstrap.php
29+
composer tests --coverage=.dev-tools/coverage
30+
composer tests --no-cache --bootstrap=tests/bootstrap.php
2831
2932
Coverage Outputs
3033
----------------

0 commit comments

Comments
 (0)