Skip to content

4.5.0

Compare
Choose a tag to compare
@muglug muglug released this 10 Feb 18:59
· 6550 commits to master since this release

Features

  • @Danysan1 added support for CodeClimate (#5030)
  • @bdsl added detection of property type variance in #5131. Non-invariant property types causes a fatal error if the property types are specified in PHP code, but can also signal issues with your code if they're specified in docblocks. Psalm has two separate issues for this, NonInvariantPropertyType and NonInvariantDocblockPropertyType.
  • Taint Analysis @adrienlucas added an option to dump the taint flow graph for debugging purposes (#5080)
  • Language Server @joehoyle added support for static class method completion (#5085) and completions for array keys (#5105) and constants (#5115)
  • Thanks to @weirdan, Psalm now emits exit code 1 only when it has internal issues. When it finds issues with your code it emits code 2 (#5087)
  • @weirdan added checks to prevent invalid implementation of Traversable (#5171)

Changes

  • The meaning of non-empty-string has been clarified to mean "every string except the empty string ''". A new type, non-falsy-string, represents "every string except the empty string and the string '0'". This follows PHP's treatment of falsiness, where the string '0' is treated as false.

Bugfixes

  • Don't discard staticness of objects when combining types (#5029)
  • @orklah fixed #5021 by having Psalm calculate more literal values
  • @lukasbestle fixed #5037 by removing the SimpleXMLIterator's reliance on the new \Stringable interface
  • avoid false-positive in a dynamic property fetch inside a ternary
  • prevent complex assertions from crashing reflection (#5025)
  • improve string non-emptiness combinations (#5017)
  • @weirdan fixed #5048 by ensuring the autoloader is started in psalm --init
  • @danog fixed #4289 by checking iterator types in yield from expressions
  • @weirdan fixed #5057 by adding flows to array spreads
  • @weirdan ensured class_alias() calls are respected when accessing static properties (#5068)
  • Language Server @joehoyle fixed a cache invalidation issue in language server mode (#5084)
  • @orklah provided a fix for #5082 by only transforming a keyed array to a callable array if there are two elements
  • @sj-i improved signatures for PDOStatement (#5100)
  • Taint Analysis prevented an issue where taint analysis could loop endlessly
  • fix issue using PDOStatement::fetchObject where stdClass is not also used (#5099)
  • Provide more errors when using named params incorrectly (#4631)
  • Unused code detection @joehoyle added reference tracking for global variables (#5122)
  • Taint Analysis @psalm-flow is now supported in methods (#5137)
  • @pilif added a parameter to DateTime::createFromInterface (#5138)
  • Psalter @orklah fixed a bug that used an inexact return type for anonymous classes (#5145)
  • Unused code detection @weirdan marked throw variables as always used (#5166)
  • @vudaltsov improved the signature for PDO::pgsqlGetNotify (#5169)
  • improve handling of callables in the form [$some_var, 'some_method_name'] (#5176)

Internal