... pushing the limits of what we can plausibly put in a point release.
Autoload warming
Added opt-in autoload warming to improve tab completion and command support. When enabled, PsySH pre-loads classes at startup, making them available to ls
, doc
, show
, and tab completion.
// Enable with defaults (project classes only)
'warmAutoload' => true,
// Advanced configuration
'warmAutoload' => [
'includeTests' => true,
'excludeNamespaces' => ['App\Tests\'],
'includeVendorNamespaces' => ['Symfony\', 'Doctrine\'],
],
Custom warmers can be implemented via AutoloadWarmerInterface
. Fixes #650
Implicit use statements
Auto-adds use
statements when you reference a class by its short name (and there's exactly one match in configured namespaces).
'implicitUse' => [
'includeNamespaces' => ['App\'],
'excludeNamespaces' => ['App\Legacy\'],
],
Works great with autoload warming to make class references feel natural.
Namespace-aware commands
doc
, show
, and ls
commands now resolve class names using the current namespace and use statements, just like code execution does.
SIGINT handling
Hitting ctrl-c during long-running code now interrupts execution and returns to the prompt instead of exiting the shell entirely. Works with or without process forking (requires pcntl and posix support). Fixes #154
Exit status support
PsySH now properly handles exit status codes! Use exit(42)
for non-zero status codes or exit('message')
to print before exiting. Also exits with non-zero status on unrecoverable errors.
Clickable documentation links
Class names, functions, interfaces, constants, and more in ls
, doc
, and show
commands are now clickable links to php.net (requires Symfony 4.3+, PsySH manual installed, and OSC 8 compatible terminal).
Other improvements
- Added
--info
CLI option - Added
--warm-autoload
CLI option - Included traits in
ClassNamesMatcher
tab completion - Print shorter return values for actions than inspection
- Improved PHPStan coverage (levels 2 and 3)
- More robust smoketests