packagist vimeo/psalm 3.4.12

latest releases: 5.x-dev, dev-master, dev-isTypeContainedByType_flags...
4 years ago

Features

  • Psalm now warns about properties without types that haven't been initialised prior to use in a constructor
  • A @readonly annotation is now supported for properties. Psalm will complain when trying to manipulate a property with that annotation from outside the class.
  • Psalm now warns if @throws classes are invalid (#2015, #2019)
  • Psalm now complains about unused function calls e.g. ; strpos("foo", "o");
  • Add support for @psalm-scope-this annotation when analysing view files (#2032)
  • Psalm can now detect unused @psalm-suppress annotations with the --find-unused-psalm-suppress flag (#1444)
  • Unnecessary use of the null coalesce operator ?? now causes Psalm emit an issue (#2035)

Potential issues

  • in anticipation of PHP 7.4's deprecation, Psalm now prevents swapping the arguments of implode
  • given $some_array['foo'] of an unknown type, after an isset($some_array['foo']['bar']) check $some_array['foo'] will be typed to array|ArrayAccess. In code that's fully typed this shouldn't be an issue (because $some_array['foo'] will always have a known type) but some code may be newly problematic e.g.
function foo(array $a) : void {
  if (isset($a["b"]["c])) {
    array_pop($a["b"]); // previously MixedArgument, now PossiblyInvalidArgument
  }
}

Bugfixes

  • analyse static property variable names (#1996)
  • make @psalm-assert-if-true work for properties on $this (#1994)
  • fix reconciliation of arrays and traversables (#1997)
  • reduce false-positives when parsing of callable strings (#2006)
  • properties with defaults should work with the static type annotation (#2010)
  • improve unused variable detection in always-entered loops (#2007)
  • allow count on an array previously checked to be callable (#2012)
  • prevent UnusedVariable complaint when a method using it as a param is not defined (#2023)
  • prevent fatal error on class_aliased reference (#2018)
  • improve handling of preg_match, thanks @ShiraNai7! (#2022)
  • allow static::SOME_CONST to have a non-mixed type in a final class (#2020)
  • fix improperly-retained !callable check when modifying (#2027)
  • add better understanding of method_exists checks (#2026)
  • allow mixed assignment when explicitly annotated - thanks @lhchavez! (#1374)
  • prevent defined(...) check from affecting class constant fetching (#2031)

Don't miss a new psalm release

NewReleases is sending notifications on new releases.