What's Changed
Features
- Support better template inference with type variables: class templates that cannot be inferred at the construction site are now tracked as type variables whose bounds are reconciled once the surrounding function has been analyzed. This legalizes widening within a template's declared bounds (e.g.
new Box(1)followed by$box->set('two')under@template T of int|string) and introduces the newIncompatibleTypeParametersissue (level 1), documented in https://psalm.dev/docs/annotating_code/type_variables/ by @muglug in #11875
Fixes
- [6.x] Fix InterfaceAnalyzer crash when storage is overwritten by reflection by @alies-dev in #11760
- [6.x] Fix
$thisfailing to parse inside generic type parameters by @alies-dev in #11768 - [6.x] Use macOS bundle ID for PhpStorm (support JetBrains Tool installed apps), respect
PHPSTORMenv var on Darwin by @alies-dev in #11801 - [6.x] Ignore inline
covariant/contravariantkeywords in generic type parameters instead of reportingUndefinedDocblockClass(backport) by @alies-dev in #11836 - Keep foreach key/value non-nullable after a breaking loop by @muglug in #11874
- PHP 8.5 compatibility:
TLiteralFloatnow rendersNANvalues asfloat(NAN)in type keys and IDs instead of crashing by @danog in 9d6db9e and ca15124
Docs
- Add
docs/annotating_code/type_variables.mdand theIncompatibleTypeParametersissue page by @muglug in #11875
Internal changes
- [6.x] fix tests: drop incorrect
impure-Closure prefix in TypeParseTest by @alies-dev in #11834 - [6.x] fix tests: whitelist
Overridein SuicidalAutoloader fixture by @alies-dev in #11835 - fix: pin GitHub Actions to SHA for supply chain security by @riccardosarro in #11863
- Clean up redundant assignment-conditions and repeated getArgs() calls by @muglug in #11888
- Remove dead write-only static properties and simplify ScopeAnalyzer break/continue logic by @muglug in #11889
- Fix
test-with-real-projects.shon macOS (usegsedwhen available, tolerate a missing phar) by @danog in 9d6db9e - Fix macOS CI: bump setup-php to v2.37.2 so PHP 8.5 installs on macos-15 by @danog in a2892dfd1
- Fix Mockery 1.6.15 compatibility in plugin tests by @danog in 7b50a1725
- Drop
voidParamTypetest: nikic/php-parser 5.8 rejects void params at parse time by @danog in 056992a90
Other changes
- Allow sebastian/diff 9 by @liviuconcioiu in #11861
New Contributors
- @riccardosarro made their first contribution in #11863
Full Changelog: 6.16.1...6.17.0