Skip to content

v0.3.4

Choose a tag to compare

@suzumaze suzumaze released this 13 Oct 01:47
· 38 commits to main since this release
a139d62

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/contexts now lists the production contexts of an application whose entry points pass the context to a bootstrap closure or class instead of calling Injector::getInstance() directly. Before, only the contexts in demo scripts and tests appeared: on public BEAR.Kata, prod-hal-app, hal-app, html-hal-app and cli-html-hal-app were missing. It now follows (require <path>)(...), (new Class())(...), (new Class())->method(...), $closure(...) and Class::method(...) into methods, closures and arrow functions that pass a parameter on as the context, through chains of them, and it scans bootstrap/ 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) under unresolved; 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 a TypeError and aborted bear/app/contexts for every other file as well. Earlier releases failed the same way.
  • A long concatenated require path can no longer abort the query under Xdebug's nesting limit, and a huge dirname() level count no longer loops. A parameter rebound with global, static or catch is no longer taken for a forwarder.
  • coverage.wrapperResolution is now positional-parameter-forwarders (it was static-positional-single-return-forwarders-only) and coverage.forwarderForms lists 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.