Skip to content

04: Config facade - #4

Open
nikolaystrikhar wants to merge 3 commits into
mainfrom
04-config
Open

04: Config facade#4
nikolaystrikhar wants to merge 3 commits into
mainfrom
04-config

Conversation

@nikolaystrikhar

@nikolaystrikhar nikolaystrikhar commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Config static facade — hook prefix, version, optional container — plus Config_Exception.

Config::set_hook_prefix( 'give' );
Config::set_container( give()->container ); // optional
  • Validation happens on write. set_hook_prefix() rejects bad values, empty string included. Validating at read time would turn a bad prefix into a filter that silently never fires, surfacing later as a misleading "you must call set_hook_prefix()".
  • Config_Exception extends RuntimeException, so callers get one catchable type across the library.
  • Tests configure the facade through Tests\Support\Test_Container, because lucatume\DI52\Container implements PSR-11's ContainerInterface, not StellarWP's. set_container()'s signature is unchanged and stellarwp/container-contract stays the only production dependency.

get_version() is stored but nothing reads it yet — spec known-issue F.

…tate

- Assert Config_Exception is catchable as RuntimeException; nothing covered
  that inheritance, so dropping it would have left the suite green.
- Reset Config in setUp() as well as tearDown(), so the tests asserting on
  default state no longer depend on class execution order.
- Note that the container fixture inherits DI52's class_exists() fallback
  in has().
- Drop a README pointer to a section that does not exist yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant