Repository navigation
v0.3.4
Production contexts for applications whose entry points hand the context to a bootstrap closure or class, and no more failures on half-typed source.
bear/app/contextsnow lists the production contexts of an application whose entry points pass the context to a bootstrap closure or class instead of callingInjector::getInstance()directly. Before, only the contexts in demo scripts and tests appeared: on public BEAR.Kata,prod-hal-app,hal-app,html-hal-appandcli-html-hal-appwere missing. It now follows(require <path>)(...),(new Class())(...),(new Class())->method(...),$closure(...)andClass::method(...)into methods, closures and arrow functions that pass a parameter on as the context, through chains of them, and it scansbootstrap/too. The environment is not read; a context that comes only from an environment variable is still unresolved.- A forwarder whose callers were seen no longer lists its inner
Injector::getInstance($context)underunresolved; one nobody calls in a followable form now lists it. - A source file that is still being typed (
'a' ??,$x ? 'a' :,()) no longer makes the whole listing fail. The parser hands back a missing token there, which raised aTypeErrorand abortedbear/app/contextsfor every other file as well. Earlier releases failed the same way. - A long concatenated
requirepath can no longer abort the query under Xdebug's nesting limit, and a hugedirname()level count no longer loops. A parameter rebound withglobal,staticorcatchis no longer taken for a forwarder. coverage.wrapperResolutionis nowpositional-parameter-forwarders(it wasstatic-positional-single-return-forwarders-only) andcoverage.forwarderFormslists the forms followed.
On BEAR.Kata, bear/app/contexts goes from 5 to 9 contexts with 0 unresolved sites instead of 1, and the query takes about 0.96 s instead of 0.78 s.
Validation: PHP 8.2–8.5 CI, PHPCS, PHPStan, 708 PHPUnit tests on PHP 8.5, and 21 syntax-broken inputs that now all complete. Each fix above has a test that failed before the change, except the dirname() level cap.