Repository navigation
Issue/633 Reduce the repeated base directory lookups - #637
Conversation
…ral times Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Reuse the base directory in environment and configuration paths src/Config/Config.php, src/Console/Commands/EnvCommand.php, src/Environment/Environment.php, CHANGELOG.md |
These components reuse one base-directory value for path construction and file checks. The changelog records these updates and the helper-path change. |
Build module-related paths from existing directories src/App/Stages/Boot/LoadHelpersStage.php, src/ResourceCache/ViewCache.php, tests/Unit/ResourceCache/ViewCacheTest.php |
LoadHelpersStage uses modules_dir() as the module-helper path root. ViewCache appends the lowercased module name to its existing cache directory. Tests check cache-directory selection with and without a module. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Refactor
Possibly related issues
quantum-php/framework#633— The issue describes the same base-directory reuse and module-helper path cleanup.
Possibly related PRs
- quantum-php/framework#442 — Both PRs use
App::getBaseDir()and concern its contract. - quantum-php/framework#635 — Both PRs change
EnvCommand::exec()and its missing-template path.
Suggested reviewers: hatik92, andrey-smaelov
Merge Risk: 
Minimal · up to a846e
-
No actionable merge-blocking risk was identified; the changes preserve existing path behavior.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 6 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Refs #633. This pull request targets
3.1.x, so it does not close the issue; the merge of3.1.xintomasterdoes.What changed
EnvCommand::exec(),Environment::resolveEnvironmentFile(),Config::resolveFilePath()andViewCache::getCacheDir()read the base directory once instead of asking for it several times in the same method.LoadHelpersStagebuilds the module helpers path withmodules_dir()instead of rebuilding it by hand.ViewCache::getCacheDir()was not in the ticket's list; it asked for the base directory twice in one method, which the acceptance criteria rule out.shared_dir()helper: it would be a new public helper in a patch release to save a few repeated'shared' . DS . 'config'strings, and the ticket allows leaving them.Why
Readability: the same call was repeated in one method, and one path was rebuilt although a helper exists.
App::getBaseDir()is cheap, so this is not about speed.Breaking changes
None. No behavior, signature or public name changes.
Testing
ViewCache::getCacheDir(), which had none: without a module (<base>/cache/views) and with moduleTest(<base>/cache/views/test). They pass on the code before and after the change, which shows the behavior is unchanged.EnvCommandTest,LoadHelpersStageTestand the Environment and Config tests.Notes for reviewers
3.1.xafter.coderabbit.yamlwas merged, so it also shows whether CodeRabbit now reviews pull requests into maintenance branches.Summary by CodeRabbit