Sync upstream updates: queue inspection contract, prompt output outside terminals and Larastan fixes
Merged
BI
1d ago+1391+1391+0123456789012345678901234567890123456789-131-131-012345678901234567890123456789
Upstream Updates
- Add the queue size and job inspection methods to the Queue contract. Every Hypervel driver already implemented them, so the stale analysis ignores in FailoverQueue are gone, the queue connection fake forwards them explicitly, and the Queue facade lists them with the contract.
- Call isReporting() and buildContextForException() directly in JsonFormatter, since the ExceptionHandler contract declares them.
- Render spinners and tasks statically when decorated output is not a terminal, such as --ansi output in CI and build logs. Progress bars and streams make the same check, decided once per run.
- Port the custom pivot accessor, SoftDeletes builder and insertOrIgnoreReturning passthru type tests. Hypervel already infers these types. The Collection Types docs now show that many-to-many results keep their pivot, including a custom as() accessor.
- Port the foreignIdFor(), foreignUuidFor() and foreignUlidFor() schema tests. For a model that can't be loaded, Hypervel adds no column and marks the table incomplete instead of guessing an integer column named after the class.
- Port the named-argument cases for rules and collectors. Hypervel's rules and collectors already read arguments by parameter name. The useless value() fix now also drops literal arguments, so value(foo: 1, value: 'bar') becomes 'bar', but it keeps the call when another argument could have side effects.
- Port the Collection offset type tests.
- Port the getArrayableAttributes() type test.
- Type base_path() as a non-empty string when given a non-empty path, so calls such as simplexml_load_file(storage_path('feeds/catalog.xml')) are no longer reported. The other path helpers and the application contract's path methods declare the same type.
Additional Hypervel changes
- Require shouldStopRetries() on the ExceptionHandler contract. The queue worker only called it when method_exists() found it, so under Exceptions::fake() or withoutExceptionHandling() it ignored dontRetry() and dontRetryWhen() and released the job. The exception fake and the without-handling handler now pass the call to the real handler. The porting guide tells custom handler authors to implement it.
- Check whether prompt output is a terminal at its real destination. Artisan's output style and buffered outputs used to fall back to STDOUT, so captured command output animated whenever the process ran in a terminal. Output that isn't a terminal also no longer receives cursor, erase, clear or title sequences, so logs keep only the text and colors.
- Size prompts from the first standard stream that is a terminal, in the order stdout, stderr, stdin. Symfony's Terminal only asked stdin, so with piped input prompts assumed 80x50 and started a new stty process on every redraw. The size is now read once before the first redraw, a failed query keeps its fallback, and COLUMNS and LINES skip the query.
- Redraw a progress bar at most every 40 ms while it advances, matching Symfony's ProgressBar. Each step still counts straight away, and the final step, start(), finish() and explicit render() calls draw immediately. 3,000 fast steps now start 3 processes instead of 3,002.
- Treat makeWith() as a container resolution in the worker-lifetime analysis, so resolving the request through makeWith() in a #[BindWhen] condition is reported like make().
- Point the porting guide's static analysis entry at the Static Analysis guide for setup, and remove notes about Larastan settings Hypervel doesn't have.
Summary by cubic
Ports upstream Laravel changes and fixes queue retry handling, prompt output outside terminals, and several PHPStan analysis gaps.
Queue contract and retries
- The
Queuecontract now requires the size and job inspection methods;QueueConnectionFakeforwards them andFailoverQueuedrops stale analysis ignores. shouldStopRetries()is now required on theExceptionHandlercontract. The exception fake andwithoutExceptionHandling()previously ignoreddontRetry()/dontRetryWhen()and released jobs; they now delegate to the real handler.
Prompts and terminal handling
- Spinners, tasks, progress bars, and streams render statically when decorated output is not a terminal; cursor, erase, clear, and title controls are suppressed outside terminals.
- Terminal size is read from the first standard stream that is a terminal (stdout, stderr, stdin), cached after the first query, and skipped when
COLUMNS/LINESare set. It falls back to 80x50 whenproc_openis disabled. - Progress bars redraw at most every 40 ms; each step still counts immediately and the final step draws immediately.
PHPStan fixes
base_path()and the other path helpers returnnon-empty-stringfor a non-empty path, removing false positives likesimplexml_load_file(storage_path('feeds/catalog.xml')).makeWith()is treated as a container resolution in the worker-lifetime analysis, so request resolution in#[BindWhen]conditions is reported.- The
value()fix now drops literal arguments without side effects, sovalue(foo: 1, value: 'bar')becomes'bar'. - Ports Larastan type tests for pivot accessors, SoftDeletes builders,
insertOrIgnoreReturning(), collection offsets,getArrayableAttributes(), andforeignIdFor()schema columns.
[!NOTE]
Sync upstream: queue inspection contract, TTY-aware prompt output, and Larastan fixes
- Adds aggregate job-count and job-inspection methods (
totalSize(), pendingJobs(), all*Jobs(), etc.) to the Queue contract, with forwarding implementations in QueueConnectionFake and suppressions removed from FailoverQueue
- Makes
ExceptionHandler::shouldStopRetries(Throwable): bool a required interface method; Worker, ExceptionHandlerFake, the withoutExceptionHandling() wrapper, and test handlers now call or forward it directly
- Adds
Prompt::canControlTerminal() (decorated output plus TTY) and RendersAnimations::shouldRenderStatically(); prompts use static rendering and strip terminal controls outside terminals, with Progress redrawing at most every 40ms
- Rewrites
Terminal::initDimensions() to query stty size from the first available TTY (fallback 80x50) and adds Terminal::isOutputTty() detection for buffered and wrapped outputs
- Syncs Larastan/phpstan updates: conditional non-empty-string path helper return types,
value() autofix for scalar literal arguments, and named-argument rule fixtures
- Risk: custom
ExceptionHandler implementations outside the tree must now define shouldStopRetries(); custom Queue implementations must implement the new inspection methods
Macroscope summarized 5b9d253.
Summary by CodeRabbit
- New Features
- Queue monitoring now provides aggregate counts and lists of pending, delayed, and reserved jobs, including across queues.
- Prompts better distinguish interactive terminals from redirected output. Animations and progress updates render appropriately, with terminal controls omitted where they cannot be used.
- Exception handlers now preserve retry decisions when wrapped, helping queued jobs follow their configured retry policies.
- Documentation
- Clarified path return types, exception-handler requirements, queue inspection, and static analysis guidance. Added guidance on pivot data in collections.