github vimeo/psalm 6.17.0

4 hours ago

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 new IncompatibleTypeParameters issue (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 $this failing 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 PHPSTORM env var on Darwin by @alies-dev in #11801
  • [6.x] Ignore inline covariant/contravariant keywords in generic type parameters instead of reporting UndefinedDocblockClass (backport) by @alies-dev in #11836
  • Keep foreach key/value non-nullable after a breaking loop by @muglug in #11874
  • PHP 8.5 compatibility: TLiteralFloat now renders NAN values as float(NAN) in type keys and IDs instead of crashing by @danog in 9d6db9e and ca15124

Docs

  • Add docs/annotating_code/type_variables.md and the IncompatibleTypeParameters issue 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 Override in 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.sh on macOS (use gsed when 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 voidParamType test: nikic/php-parser 5.8 rejects void params at parse time by @danog in 056992a90

Other changes

New Contributors

Full Changelog: 6.16.1...6.17.0

Don't miss a new psalm release

NewReleases is sending notifications on new releases.