Repository navigation
Open
Labels
configConfiguration package and loadingConfiguration package and loadingrefactoringtech debtTechnical debt reductionTechnical debt reduction
Milestone
Description
Summary
Deprecate the hierarchical flag of Quantum\Config\Setup in 3.1.2, with no change in behavior. It is removed in 3.2.0.
Why
- The flag controls one thing: when a config file is not found in the module's folder,
Config::resolveFilePath()falls back toshared/<prefix>/<file>.php. That is a fallback or override rule, not a hierarchy. The name suggests the "hierarchical" in HMVC, which means nested sub-requests between MVC triads and has nothing to do with config lookup. - The flag defaults to
true, and nothing insrcturns it off: everynew Setup('config', '<name>')call uses the default. OnlySetupTestcallsgetHierarchy()andsetHierarchy(). - Turning it off is a trap. A global config such as
new Setup('config', 'app')has no module, so its first path is<base>/config/app.php, which does not exist in a project. The files live inshared/config, and only the fallback finds them.
Proposed change
- Mark
Setup::setHierarchy(),Setup::getHierarchy()and the$hierarchicalconstructor parameter@deprecated, saying that the shared fallback is always on from 3.2.0. - Raise
E_USER_DEPRECATEDwhen the setter is called or when the constructor receives the third argument (func_num_args() > 2), with a message that names the removal in 3.2.0. The error handler already logs deprecations as warnings, so nothing stops. The defaulttruedoes not raise anything. - Behavior stays exactly as it is.
- Describe the lookup in the docs as the "shared fallback" or "lookup order", not as a "hierarchy" (
advanced-features/configuration.md). That is a change in the docs repository.
Out of scope
- Removing the flag: it is planned for 3.2.0, tracked in the removal ticket.
Breaking changes
- None.
Acceptance criteria
- the two methods and the constructor parameter are marked
@deprecated - calling
setHierarchy()or passing the third constructor argument raisesE_USER_DEPRECATED, and the default call does not; a test covers both - the lookup result is unchanged for
trueandfalse, and the existing tests still pass composer test,composer cs:check,composer phpstanandcomposer rector:checkpass on every PHP version in the CI matrix- the changelog lists the deprecation
Metadata
Metadata
Assignees
Labels
configConfiguration package and loadingConfiguration package and loadingrefactoringtech debtTechnical debt reductionTechnical debt reduction
Activity