Psalm v4.3.1 Release Notes
Release Date: 2020-12-03 // about 4 years agoPrevious changes from v4.3.0
-
π Features
UnusedConstructor
is now a separate issue fromUnusedMethod
. This allows people to use the private constructor pattern to prevent instantiation of classes that just have static methods (#4656)- π
RedundantCast
is now a separate issue fromRedundantCondition
. It is now emitted for more redundant casts thanks to @orklah adding better detection (#4695) - π @odoucet added support for the CodeClimate output format (#4387)
- β @weirdan added a test to ensure all new Psalm annotations are documented (#4723)
RedundantPropertyInitializationCheck
is now emitted forisset
checks on class properties that Psalm thinks should be defined. This allows users who prefer to initialize properties outside constructors to silence just that issue (#4732)
π Bugfixes
Psalter
- π @orklah added support for adding
static
return types when running in PHP 8 (#4641) - π @orklah added support for adding
int|string
phpdoc standin forarray-key
(#4645) - π @orklah added support for adding
string
phpdoc standin forFoo::class
(#4651) - π use union types in PHP 8 wherever possible (#4643)
Taint analysis
- @LukasReschke added flows for many common PHP functions (#4591, #4659)
- @LukasReschke added taint propagation for variadics (#4649)
- it's now possible to set up conditional tainting based on a function's parameters (#4661)
PHP 8 compatibility
- Promoted properties are always treated as initialised (#4615)
- Flag invalid attribute arguments (#4611)
- Ensure classes used as attributes themselves have the
Attribute
attribute (#4475) - Ensure the
Attribute
attribute is only valid on classes (#4609) - π @orklah fixed param names on core functions to enable named-argument calling in PHP 8 (#4745)
- π @orklah fixed return type additions when returning from
finally
(#4746)
Miscellaneous
- π Allow the Phar to run in PHP 7.2 (#4640)
- Prevent crash with recursively-defined
@psalm-type
in root namespace (#4653) - @staabm made many file-based functions impure (#4674, #4676, #4679, #4678)
- @erikjwaxx narrowed the return type for
$a <=> $b
(#4680) - @orklah prevented the use of illegal array keys (#4660)
- π @BenMorel added a better return type for `PDOStatement::fetchObject' (#4682)
- treat
isset
like!== null
when the variable is defined (#4699) - π @orklah fixed an incorrect cast to int when the integer is very large (#4702)
- π @LeSuisse fixed a bug in the taink sink map (#4703)
- @orklah fixed reconciliation of
is_object($some_iterable)
(#4712) - π use correct keys when a list with a known length is compared to an array (#3017)
- template types are no longer substituted when theyβre defined on the same class (#4733)
- π provide better support for nested template type definitions (#4731)
- @orklah ensured that non-emptiness is treated as a docblock-level assertion (#4736)
- π @orklah added much better typing for bitshift operators (#4740)
- simplified assertions generated from
array_key_exists
to prevent performance degradation (#4743) - prevent stubs from breaking implicit docblock param inference (#4705)
- π allow errors stemming from
@final
attribute to be suppressed (#4751)