Immutability
Psalm now has support for detecting and enforcing immutability (#1272). Includes support for new annotations
Other features
DeprecatedClass
now emitted when it's used in a function signature (#2028)- there are now a few more unions with
mixed
allowed, which means Psalm can find more bugs in not-fully-typed code (#2046) - added some more documentation - thanks @staabm and @lhchavez (#2056, #2068)
- Separate
"hello"++
and similar issues into separateStringIncrement
issue for people who use that feature (#2061) - Psalm now forgets property assertions made when calling functions known to alter those properties. This previously required setting the
rememberPropertyAssignmentsAfterCall
flag to"false"
. Now that flag is not required in most cases (#886, #1812)
Bugfixes
- Prevent crash when using
@deprecated
above variable annotation (#2041) - Fix some false-positives around unused variables and unused functions (#2047, #2053, #2052, #2062, #2089)
- Fix iteration inference over
SimpleXMLElement
(#2045) - Fix
Generator::throw
param type - thanks @kelunik (#2059) - Improve understanding of assignments in
elseif
(#2073) - Allow mixed array to be assigned specific string keys (#2048)
- Allow more complex properties to have their type inferred (#2071)
- Fix assingmentref type - thanks @lhchavez (#2077)
- Allow
Assert::true
and comparable to assert general truthiness (#2081) method_exists
should not alter first string type (#2083)- Fix loading order of
Psalm\Internal\Fork\Pool
- thanks @Nyholm (#2082) - Improve use of closure docblocks (#2089)
- Fix handling of
hideExternalErrors
config (#2074) - Handle
$this
docblock types in traits (#2091) - Psalter - don't replace more specific return types when
@inheritdoc
present (#2013) - Unused code detection Prevent vendor method-implementing classes from
UnusedMethod
(#910) - Fix param type for
PDO::lastInsertId
- thanks @ADmad (#2092) - Respect
@method
annotations even when method exists (#2095) - Allow
@psalm-assert
to propagate property assertions to non-$this
vars - thanks @lhchavez (#2099) - Improve handling of generated template class from templated class-string (#2106)
- Don’t crash with bad
@method
(#2104) - Use better fallback for callmap functions when types don’t match (#2101)