This release introduces an internal plugin system for the analyzer, adds new linter rules, and continues the focus on minimizing false positives.
New Features
Analyzer
- Internal plugin system: Adds an extensible architecture for type providers, enabling custom return type inference for functions and methods
UnitEnum::cases()return type provider: Properly infers the return type ofcases()on unit enums
Linter
- New
instanceof-stringablerule: Suggests using$x instanceof Stringableinstead of the verboseis_object($x) && method_exists($x, '__toString')pattern
Bug Fixes
Analyzer
parent::now works in traits with@require-extendsannotation (#732)- Objects with
__toStringmethod can be cast to string without errors - Concrete-to-template type assertions no longer flagged as redundant
- Explicit type assertions in ternary expressions are preserved correctly
- Null access warnings suppressed on RHS of nullsafe operations (
?->) - Redundant type comparisons are now properly reported
- Template parameters with compatible constraints are allowed
- Static enum types resolve correctly
- String callables accepted; declared list parameter types in closures respected
- Memoized values cleared after any invocation to prevent stale type information
Codex
$thishandling corrected in type expansion- Static type resolves to concrete class when class name is known
- Strings combiner fixed for accurate type unions
- Array/list identical check corrected
Formatter
- Arrow function ternary bodies wrapped in parentheses; outer calls break correctly
- Argument lists break when an argument has a trailing line comment
Linter
- Annotation spans narrowed to highlight minimal code regions
Type Syntax
- Trailing comma allowed after open array additional fields
Full Changelog: 1.0.0-rc.12...1.0.0-rc.13