github vimeo/psalm 4.9.0
First community release

latest releases: 5.24.0, 5.23.1, 5.23.0...
2 years ago

Features

  • (#5974, #5980) Ability to turn off inferPropertyTypesFromConstructor (thanks @weirdan)
  • (#6008, #6010) LSP server now runs analysis on open and save (thanks @tm1000)
  • (#6013, #6014, #6055) LSP server now understands didChangeWatchedFiles notification (thanks @tm1000)
  • (#6058, #6059) Support for xml:base attribute (useful for modular configs) (thanks @turnabout)
  • (#6060) FunctionReturnTypeProviderEvent and MethodReturnTypeProviderEvent now provide access to the statement via getStmt() method (thanks @VincentLanglet)
  • (#6106) Added support for interface-string<FooInterface> (currently as an alias to class-string<FooInterface>) (thanks @muglug)
  • (#5512) Added option to enable Shepherd reporting with environment variables (PSALM_SHEPHERD and PSALM_SHEPHERD_HOST) (thanks @ngmy)
  • (#6117, #6130) Psalm now flags static access to non-static property (and vice versa) (thanks @weirdan)
  • (#6155) Added support for PHP 8.1 native readonly flag on properties (thanks @muglug)
  • (#6110, #6142) Now you may configure trigger_error() behavior (thanks @orklah)
  • (#6152, #6181) Psalm now understands that the only descendants of DateTimeInterface are DateTime and DateTimeImmutable (thanks @Jack97)
  • (#6207) Preliminary support for int ranges (e.g. int<min, 25>, int<2, 8> etc) (thanks @orklah)

Fixes

  • (#5981, #5992) Marked more built-in functions as impure (thanks @samsonasik)
  • (#5964) Fixed RdKafka\ProducerTopic::producev() (thanks @danog)
  • (#5975, #5989) Values used in throw are no longer considered unused (thanks @weirdan)
  • (#5979, #6000) Fixed newline-related issues when using baseline cross-platform (Windows/everything else) (thanks @bdsl)
  • (#5997, #6007) Fixed errors during LSP shutdown sequence (thanks @tm1000)
  • (#6011, #6012) Fixed psalm-language-server crash when invoked with --version argument (thanks @tm1000)
  • (#6005, #6019) Correctly resolve self and static in callable arrays passed to array_reduce() (thanks @elnoro)
  • (#3287, #6036) Fixed mbstring functions signatures (they changed in PHP 8) (thanks @mpesari)
  • (#6038, #6039) Generic part of the array shape is no longer erased by array_map() (thanks @weirdan)
  • (#6027, #6041) Fixed inferred value for __FUNCTION__ constant used in methods (thanks @orklah)
  • (#6040) DateTime::format() and DateTimeImmutable::format() return values on PHP 8 (thanks @j4nr6n)
  • (#6062) Do not interpret psalm.xml in --config psalm.xml as a file to check (thanks @simPod)
  • (#4663, #5378, #6063, #6064) Fixed parsing of negative int literals (thanks @ElisDN)
  • (#6050, #6054) Fixed crash due to internal structures getting out of sync (thanks @caugner)
  • (#6016, #6069) Improve str_word_count() signature (thanks @elnoro)
  • (#5584) Added ReflectionProperty::hasType() and ReflectionProperty::getType() stubs (thanks @franmomu)
  • (#5971, #6068) Fixed plugin crash due to missing ClassLikeStorage (thanks @caugner)
  • (#5608) Ignore string keys in callable arrays passed to preg_replace_callback() (thanks @paxal)
  • (#6066, #6072) Tightened constraints on generic type parameter inference that might lead to runtime errors (thanks @muglug)
  • (#6061, #6081) Analyze array keys before values (thanks @muglug)
  • (#6080, #6082) join() signature is synced to implode() (thanks @weirdan)
  • (#5790, #6083) Emit InvalidArgument instead of PossiblyFalseArgument when the argument is certainly false (thanks @orklah)
  • (#5957, #6084) Fixed false-positive UnusedVariable issues on values used in bitwise OR and NOT (thanks @elnoro)
  • (#6088, #6089) Fixed crash on closed resource used in switch (thanks @orklah)
  • (#6049, #6094) Fixed inference of non-empty-string returned from str_pad() and str_repeat() (thanks @weirdan)
  • (#6104) Fixed return type for strtoupper() (thanks @staabm)
  • (#6116) Fixed return type for radius_send_request() (thanks @fkooman)
  • (#2616, #6107) Fixed return type for get_defined_constants() (thanks @orklah)
  • (#6119, #6121) Allowed zero for all bitmask types (thanks @weirdan)
  • (#6122, #6123) Fixed path to be relative in CodeClimate reports (thanks @caugner)
  • (#6118, #6127) Deprecated properties are now reported even when they are read with $this->prop (thanks @weirdan)
  • (#3421) Fixed useless empty cache folder being created (thanks @JoshuaBehrens)
  • (#3903) Now Psalm emits RedundantIdentityWithTrue for !== false as it did for === true before (thanks @greg0ire)
  • (#6091, #6099) Fixed signatures for XmlWriter methods (thanks @aboks)
  • (#6111, #6129) Prevented false-positive UnusedVariable issues on global vars (thanks @orklah)
  • (#5736, #6131) bindtextdomain() is no longer considered pure (thanks @orklah)
  • (#4344, #5663, #5639, #5955, #3272, #6133) Allow more types for magic properties defined with @property (thanks @weirdan)
  • (#6146) Fixed XML report generation when issues contain taint trace (thanks @ndench)
  • (#6145, #6150) Fixed false-positive UnusedVariable when value is used as operand of unary plus and minus (thanks @weirdan)
  • (#6149) Fixed signatures of fputcsv(), SplFileObject::fputcsv() and SplTempFileObject::fputcsv() (thanks @weirdan)
  • (#6168, #6169) Arithmetic operations on numeric types are now flagged in strictBinaryOperands mode (thanks @orklah)
  • (#6160, #6170) Fixed array_slice() return type when used on generic parameters (thanks @Jack97)
  • (#6166) Fixed false positives on incrementing a numeric-string (thanks @orklah)
  • (#6172) Fixed crash on unbalanced parentheses in docblock types (thanks @Jack97)
  • (#6167) Fixed result type of non-div arithmetic operations on numeric and int|float (thanks @orklah)
  • (#6177, #6178) Fixed return type of shell_exec() (thanks @VincentLanglet)
  • (#6128, #6187) Fixed docblock parameter being reported as nullable when it was actually the native type that was nullable (thanks @orklah)
  • (#6136, #6188) Psalm no longer considers print(), exit(string) and die(string) pure (thanks @Jack97)
  • (#6186, #6192) Fixed return type of array_replace() and array_replace_recursive() (thanks @orklah)
  • (#6195, #6196) Fixed return type of exec() (thanks @weirdan)
  • (#6197, #4871) Fixed false positive ArgumentTypeCoercion for class-strings passed as attribute constructor parameters (thanks @orklah)
  • (#6199, #6206) Fixed return types for get_headers() and get_meta_tags() (thanks @Jack97)

Docs

  • (#6038) Updated Sublime LSP instructions (thanks @DannyJJK)
  • (#6047) Added example for asserting method returns (thanks @simonhammes)
  • (#6198) Clarified that taint analysis is best run when Psalm detects no regular errors (thanks @mmcev106)

Typos

@antonioeatgoat and @orklah fixed some typos (#6033, #6185, #6205)

Don't miss a new psalm release

NewReleases is sending notifications on new releases.