Releases: vimeo/psalm
Releases · vimeo/psalm
5.1.0
What's Changed
Deprecations
Features
- check "never" return type more strictly by @kkmuffme in #8624
- Report by issues grouped by level and type by @bdsl in #8774
Fixes
- Ignore non-existing classes during initial scan of intersection types by @danog in #8794
- handle true/false reconciliation consistently, fix #8795 by @orklah in #8796
- fix sealed combination by @orklah in #8798
- Fix #8806 by @danog in #8809
Docs
- Update installation.md -
5
requires PHP >= 7.4 by @sasezaki in #8805 - Adds documentation for the
forbiddenFunctions
config option by @p810 in #8808
New Contributors
Full Changelog: 5.0.0...5.1.0
Psalm 5
Welcome to Psalm 5!
There's an accompanying post on psalm.dev, written by @muglug & the current maintainers of Psalm.
- read in English
- read in Ukrainian (translated by @weirdan)
- read in French (translated by @orklah)
- read in Italian (translated by @danog)
What's Changed
Removed
- Php version consistency by @orklah in #6898
- Removed TEmpty by @orklah in #6662
- remove support for allowPhpstormGenerics by @orklah in #6705
- remove exitFunctions for Psalm5 by @orklah in #6808
- Drop legacy procedural files by @weirdan in #7270
- Dropped removed config entries by @weirdan in #7272
- Dropped legacy plugin API by @weirdan in #7275
- Dropped deprecated
CodeIssue
methods by @weirdan in #7276 - Dropped deprecated
DocComment
methods by @weirdan in #7278 - Dropped
THtmlEscapedString
by @weirdan in #7285 - Drop orphaned token by @weirdan in #7290
- Bump PHP version to 7.4 by @weirdan in #7291
- Remove forbidEcho by @orklah in #7420
- remove TPositiveInt by @orklah in #7473
- Lock event classes by @weirdan in #7491
- [TASK] Add AfterFunctionLikeAnalysisEvent::getFunctionlikeStorage by @ohader in #7526
- Finalize (and internalize) more classes by @weirdan in #7578
- Finalize issues by @weirdan in #7595
- Finalize storages by @weirdan in #7597
- Finalize virtual nodes by @weirdan in #7598
- Finalize types nodes by @weirdan in #7623
- remove totallyTyped by @orklah in #7651
Features
- Support PHPStan notation for empty-arrays by @orklah in #7312
- Try to provide literal int types when possible (fixes #6966) by @ricardoboss in #7071
- Allow config to define thread count by @M1ke in #7442
- Contextual type inference for high order function arg by @klimick in #7417
- feat: Handle native intersection types by @petewalker in #7454
- improve support for enum_exists by @orklah in #7404
- Support type annotations for class consts (fixes #942). by @AndrolGenhald in #7123
- Improve class constant static analysis by @AndrolGenhald in #7154
- Add support for references and improve UnusedVariable checks (fixes #7254). by @AndrolGenhald in #7339
- InternalTaintSinkMap: Add
getimagesize
as SSRF sink by @mal-tee in #7504 - Enable extensions based on composer.json instead of those loaded at runtime (fixes #5482). by @AndrolGenhald in #7107
- Dynamic function storage provider by @klimick in #7471
- ❗Allow plugins to modify Config::$fileExtensions early by @ohader in #6789
- [FEATURE] Introduce BeforeStatementAnalysisEvent by @ohader in #7535
- [FEATURE] Allow to intercept adding issue in IssueBuffer by @ohader in #7530
- Ensure all template parameters are specified in all extended|used classlikes by @danog in #7492
- feat: make key-of/value-of usable with non-const arrays by @Patrick-Remy in #7396
- More class const improvements. by @AndrolGenhald in #7666
- Add
@psalm-check-type
and@psalm-check-type-exact
. by @AndrolGenhald in #7686 - feat(types): add properties-of type by @Patrick-Remy in #7359
- Invert meaning of dupe_key by @danog in #7475
- Feature: allow non-union assertion types by @boesing in #8077
- Allow
value-of
to work with backed enums (fixes #7874). by @AndrolGenhald in #8283 - Add capability to use inclusion files in a different directory (fix) by @gmessier in #8402
- Add dirname return type provider by @mcaskill in #8611
- Add stubs for ext-ffi by @LeSuisse in #8614
- add basename return type provider by @kkmuffme in #8620
- Add stubs for ext-random (PHP 8.2) by @lptn in #8649
- Add support for strict arrays, fix type alias intersection, fix array_is_list assertion on non-lists by @danog in #8395
- Add support for phpstan-param-out by @VincentLanglet in #8678
- add --no-progress to psalter by @kkmuffme in #8709
- Allow
new
on objects by @weirdan in #8723
Fixes
- Use InvalidScalarArgument only when we can be sure PHP attempts coercion by @muglug in #7188
- Trim baseline selection by @weirdan in #7279
- Prevent NoValue when there is no phpdoc by @orklah in #7399
- create a return type provider for mb_internal_encoding by @orklah in #7437
- Array key exists assert both ways by @orklah in #7449
- [TypeProvider] Provide argument types during FunctionParamsProviderEvent by @veewee in #7394
- Fix stub parent class not loaded. by @AndrolGenhald in #7110
- fix code where the offset was wrong by @orklah in #7463
- reconcile two arrays by intersecting them by @orklah in #7470
- fix error with 0 being considered positive by @orklah in #7487
- Fix crash due to unresolvable constant. by @AndrolGenhald in #7490
- Fix failing case for const analyzer. by @AndrolGenhald in #7503
- Fix side effect when loading config by @AndrolGenhald in #7506
- improve literal inequality with ranges and rework GreaterThan/LessThan assertions by @orklah in #7511
- Remove mic-drop hack from if analysis by @muglug in #7484
- fix some iterator stubs by @orklah in #6970
- Fix empty array by @orklah in #7517
- add back empty keyword by @orklah in #7533
- Fix crash when assigning reference to unknown array offset by @AndrolGenhald in #7583
- Fix #6683 by improving simplification of CNF by @muglug in #7631
- Enum collapsing by @orklah in #7655
- Enum assertions by @orklah in #7662
- Consistency for empty reconciliations by @orklah in #7663
- fix count with match on arrays by @orklah in #7665
- Prevent unnecessary filter_var() warnings on primitive types by @mmcev106 in #7677
- Improve bool to int casting. by @AndrolGenhald in #7696
- Fix issues with int range unpacking and with min/max by @AndrolGenhald in #7699
- Fix some minor issues with references. by @AndrolGenhald in #7684
- restore callable-string Id by @orklah in #7787
- fix refining lowercase string and non-empty-string together by @orklah in #7844
- Remove
@psalm-generator-return
annotation by @jrmajor in #7853 - Resolve #7855 remove false from return type, in php8.0 and further ve… by @dkemper in #7859
- Fix class const issue when using floats declared in future consts (fixes #7973). by @AndrolGenhald in #7992
- Improve handling of unsupported references (fixes #8018). by @AndrolGenhald in #8022
- Bring back disableVarParsing option by @danog in #8058
- Skip native classlike aliases by @danog in #8080
- Fix nasty parameter storage corruption bug by @danog in #8098
- Change return type of createFromInterface() on DateTime and DateTimeImmutable to static by @bitwise-operators in #8102
- Update DOM stub and add separate SimpleXML stub by @AndrolGenhald in #8140
- Track taints in static properties by @muglug ...
5.0.0-rc1
This is the last pre-release before Psalm 5 official release
What's Changed
Removed
- Php version consistency by @orklah in #6898
- Removed TEmpty by @orklah in #6662
- remove support for allowPhpstormGenerics by @orklah in #6705
- remove exitFunctions for Psalm5 by @orklah in #6808
- Drop legacy procedural files by @weirdan in #7270
- Dropped removed config entries by @weirdan in #7272
- Dropped legacy plugin API by @weirdan in #7275
- Dropped deprecated
CodeIssue
methods by @weirdan in #7276 - Dropped deprecated
DocComment
methods by @weirdan in #7278 - Dropped
THtmlEscapedString
by @weirdan in #7285 - Drop orphaned token by @weirdan in #7290
- Bump PHP version to 7.4 by @weirdan in #7291
- Remove forbidEcho by @orklah in #7420
- remove TPositiveInt by @orklah in #7473
- Lock event classes by @weirdan in #7491
- [TASK] Add AfterFunctionLikeAnalysisEvent::getFunctionlikeStorage by @ohader in #7526
- Finalize (and internalize) more classes by @weirdan in #7578
- Finalize issues by @weirdan in #7595
- Finalize storages by @weirdan in #7597
- Finalize virtual nodes by @weirdan in #7598
- Finalize types nodes by @weirdan in #7623
- remove totallyTyped by @orklah in #7651
Features
- Support PHPStan notation for empty-arrays by @orklah in #7312
- Try to provide literal int types when possible (fixes #6966) by @ricardoboss in #7071
- Allow config to define thread count by @M1ke in #7442
- Contextual type inference for high order function arg by @klimick in #7417
- feat: Handle native intersection types by @petewalker in #7454
- improve support for enum_exists by @orklah in #7404
- Support type annotations for class consts (fixes #942). by @AndrolGenhald in #7123
- Improve class constant static analysis by @AndrolGenhald in #7154
- Add support for references and improve UnusedVariable checks (fixes #7254). by @AndrolGenhald in #7339
- InternalTaintSinkMap: Add
getimagesize
as SSRF sink by @mal-tee in #7504 - Enable extensions based on composer.json instead of those loaded at runtime (fixes #5482). by @AndrolGenhald in #7107
- Dynamic function storage provider by @klimick in #7471
- ❗Allow plugins to modify Config::$fileExtensions early by @ohader in #6789
- [FEATURE] Introduce BeforeStatementAnalysisEvent by @ohader in #7535
- [FEATURE] Allow to intercept adding issue in IssueBuffer by @ohader in #7530
- Ensure all template parameters are specified in all extended|used classlikes by @danog in #7492
- feat: make key-of/value-of usable with non-const arrays by @Patrick-Remy in #7396
- More class const improvements. by @AndrolGenhald in #7666
- Add
@psalm-check-type
and@psalm-check-type-exact
. by @AndrolGenhald in #7686 - feat(types): add properties-of type by @Patrick-Remy in #7359
- Invert meaning of dupe_key by @danog in #7475
- Feature: allow non-union assertion types by @boesing in #8077
- Allow
value-of
to work with backed enums (fixes #7874). by @AndrolGenhald in #8283 - Add capability to use inclusion files in a different directory (fix) by @gmessier in #8402
- Add dirname return type provider by @mcaskill in #8611
- Add stubs for ext-ffi by @LeSuisse in #8614
- add basename return type provider by @kkmuffme in #8620
- Add stubs for ext-random (PHP 8.2) by @lptn in #8649
- Add support for strict arrays, fix type alias intersection, fix array_is_list assertion on non-lists by @danog in #8395
- Add support for phpstan-param-out by @VincentLanglet in #8678
- add --no-progress to psalter by @kkmuffme in #8709
- Allow
new
on objects by @weirdan in #8723
Fixes
- Use InvalidScalarArgument only when we can be sure PHP attempts coercion by @muglug in #7188
- Trim baseline selection by @weirdan in #7279
- Prevent NoValue when there is no phpdoc by @orklah in #7399
- create a return type provider for mb_internal_encoding by @orklah in #7437
- Array key exists assert both ways by @orklah in #7449
- [TypeProvider] Provide argument types during FunctionParamsProviderEvent by @veewee in #7394
- Fix stub parent class not loaded. by @AndrolGenhald in #7110
- fix code where the offset was wrong by @orklah in #7463
- reconcile two arrays by intersecting them by @orklah in #7470
- fix error with 0 being considered positive by @orklah in #7487
- Fix crash due to unresolvable constant. by @AndrolGenhald in #7490
- Fix failing case for const analyzer. by @AndrolGenhald in #7503
- Fix side effect when loading config by @AndrolGenhald in #7506
- improve literal inequality with ranges and rework GreaterThan/LessThan assertions by @orklah in #7511
- Remove mic-drop hack from if analysis by @muglug in #7484
- fix some iterator stubs by @orklah in #6970
- Fix empty array by @orklah in #7517
- add back empty keyword by @orklah in #7533
- Fix crash when assigning reference to unknown array offset by @AndrolGenhald in #7583
- Fix #6683 by improving simplification of CNF by @muglug in #7631
- Enum collapsing by @orklah in #7655
- Enum assertions by @orklah in #7662
- Consistency for empty reconciliations by @orklah in #7663
- fix count with match on arrays by @orklah in #7665
- Prevent unnecessary filter_var() warnings on primitive types by @mmcev106 in #7677
- Improve bool to int casting. by @AndrolGenhald in #7696
- Fix issues with int range unpacking and with min/max by @AndrolGenhald in #7699
- Fix some minor issues with references. by @AndrolGenhald in #7684
- restore callable-string Id by @orklah in #7787
- fix refining lowercase string and non-empty-string together by @orklah in #7844
- Remove
@psalm-generator-return
annotation by @jrmajor in #7853 - Resolve #7855 remove false from return type, in php8.0 and further ve… by @dkemper in #7859
- Fix class const issue when using floats declared in future consts (fixes #7973). by @AndrolGenhald in #7992
- Improve handling of unsupported references (fixes #8018). by @AndrolGenhald in #8022
- Bring back disableVarParsing option by @danog in #8058
- Skip native classlike aliases by @danog in #8080
- Fix nasty parameter storage corruption bug by @danog in #8098
- Change return type of createFromInterface() on DateTime and DateTimeImmutable to static by @bitwise-operators in #8102
- Update DOM stub and add separate SimpleXML stub by @AndrolGenhald in #8140
- Track taints in static properties by @muglug in #8150
- Fix type reconciliation breaking Context::$references_in_scope (fixes #8289). by @AndrolGenhald in #8306
- Update
CachingIterator::getCache
stub. by @drupol in #82...
4.30.0
What's Changed
Features
- Enhance type detection for internal php functions
key
,current
,end
andreset
by @boesing in #8584 - Add dictionary delta for PHP 8.2 by @lptn in #8634
- Add support for phpstan assertions by @VincentLanglet in #8654
Fixes
- Add additional checks for concat of non-empty strings to return non-falsy by @gphargreaves in #8585
- Correct return type of DateTimeImmutable sub method stub by @gphargreaves in #8583
- fix wrong php version id in $_FILES by @kkmuffme in #8600
- #7810/improve reflection stubs by @gphargreaves in #8592
- ensure callbacks have the required number of params by @kkmuffme in #8594
- Fix for issue #8631 by @hamburnyog in #8639
- Fix XMLReader::expand() nullable parameter $baseNode by @BenMorel in #8641
- Do not report serialize as unused by @VincentLanglet in #8650
- serialize is not pure for array of object by @VincentLanglet in #8652
- Fix Spl file handling signatures by @neclimdul in #8644
- Remove
argc
andargv
elements from$_ENV
by @weirdan in #8666 - adding openssl_x509_verify by @orklah in #8677
Internal changes
- Allow to set PHP 8.2 version by @franmomu in #8643
- Fix assert testing callmap return types by @othercorey in #8676
New Contributors
- @neclimdul made their first contribution in #8644
Full Changelog: 4.29.0...4.30.0
4.29.0
What's Changed
Fixes
- Update dictionaries for hash ext functions by @lptn in #8553
- More specific superglobals feedback update by @kkmuffme in #8561
- Update Phpredis stubs to return false on failure by @kkmuffme in #8555
- Fix MinMaxReturnTypeProvider when handling TDependentListKeys by @nosnickid in #8567
New Contributors
- @nosnickid made their first contribution in #8567
Full Changelog: 4.28.0...4.29.0
4.28.0
What's Changed
Features
- Make ctype_digit and ctype_lower work as assertions by @fluffycondor in #8450
- report invalidCasing when using a class that is not user defined too by @kkmuffme in #8465
- Update call maps for MongoDB extension by @alcaeus in #8432
- Add dateTimeModify return type provider by @VincentLanglet in #8462
- make superglobals more specific by @kkmuffme in #8473
- Fix invalid casts int and float by @kkmuffme in #8366
- add hideAllErrorsExceptPassedFiles config option by @kkmuffme in #8502
- Add int type aliases based on existing codes by @hamburnyog in #8530
- Add check for class const with reserved word 'class' by @gphargreaves in #8542
Fixes
- Fix ctype_digit assertion bug by @fluffycondor in #8466
- partial revert nullable type for curl_multi_getcontent by @kkmuffme in #8367
- classlike_alias incorrect casing not handled correctly by @kkmuffme in #8468
- Update phpredis.phpstub by @sergkash7 in #8136
date_get_last_errors()
,DateTime::getLastErrors()
may return false by @gsteel in #8478- Fix array_key_exists first argument false positive by @hirokinoue in #8489
- Fix array_column with object and column name null by @HypeMC in #8491
- Add null-type to several DOM-functions by @tvdijen in #8490
- Make Psalter add
@throws
annotation with properly namespaced exception by @d-claassen in #8480 - use cache for declared function when available before falling back to stubs by @kkmuffme in #8503
- fix crash in <PHP8 with ResourceBundle by @kkmuffme in #8416
- Fixed function signatures of imap_delete and imap_undelete by @ppdeblieck in #8537
Docs
- Document the object with properties syntax by @HypeMC in #8493
- Make template constraints examples in docs consistent by @HypeMC in #8492
Internal changes
- GitHub Workflows security hardening by @sashashura in #8451
- preg_replace with anchor will always only have 1 replacement by @kkmuffme in #8469
- Consistent error logging for cache by @kkmuffme in #8415
New Contributors
- @sashashura made their first contribution in #8451
- @alcaeus made their first contribution in #8432
- @sergkash7 made their first contribution in #8136
- @gsteel made their first contribution in #8478
- @HypeMC made their first contribution in #8493
- @d-claassen made their first contribution in #8480
- @hamburnyog made their first contribution in #8530
- @ppdeblieck made their first contribution in #8537
- @gphargreaves made their first contribution in #8542
Full Changelog: 4.27.0...4.28.0
4.27.0
What's Changed
Features
- added truthy-string alias for non-falsy-string by @staabm in #8400
- added SensitiveParameter, AllowDynamicProperties php 8.2 attributes by @staabm in #8427
- Allow *bin2hex and *bin2base64 functions to keep non-empty-string type by @LeSuisse in #8431
- Allow any attribute for complex types in schema by @den-kuz in #8428
- trim(), ltrim(), rtrim() now keep lowercase string attribute by @SCIF in #8444
Fixes
- Added better stubs for
DateTimeImmutable
, highlighting how the constructor is NOT immutable by @Ocramius in #8350 - Use classlike_storage_provider only if it has the required data by @Daeroni in #8376
- Fix
imageinterlace
function signature by @paulfedorow in #8403 - Clarification of
Reflection::getModifierNames()
result type by @vjik in #8405 - Ensure we recognize inherited static methods for the first-class callables by @someniatko in #8370
- Add support for callable in array_reduce by @VincentLanglet in #8435
- Configure a correct attribute target in stubs/CoreGenericClasses.phpstub by @TimWolla in #8436
Internal changes
Typos
- add ", but" for InvalidArgument error message where a type is provided by @kkmuffme in #8364
- Fix doc typos by @krsriq in #8424
New Contributors
Full Changelog: 4.26.0...4.27.0
4.26.0
What's Changed
This release fix an regression introduced in the last version. Upgrade is recommended
Fixes
- #8330 - take into account that
static
type may have been unwrapped inhasStaticInType()
by @someniatko in #8335 - recognize
@psalm-allow-private-mutation
in PHP 8+ constructors by @someniatko in #8341 - ReflectionProperty::getValue $object is nullable since php 8.0 by @mathroc in #8344
- Fix formatCurrency return type by @VincentLanglet in #8349
Full Changelog: 4.25.0...4.26.0
4.25.0
What's Changed
Features
- New "Count" Report Format by @jack-worman in #8244
- Adds support for fixing missing throws doc block by @aszenz in #7994
Fixes
- Stop using deprecated string interpolation syntax in StatementsProvider.php by @TimWolla in #8188
- Fix return type of ReflectionNamedType::getName() by @BenMorel in #8201
- Fix several CallMap function signatures by @othercorey in #8217
- fix: ltrim may return class-string #8218 by @Tofandel in #8219
- use lock to fix race condition in cache by @kkmuffme in #8240
- Fix GEOSGeometry stubs with default values by @BenMorel in #8214
- Fix nullable return types for CallMap functions by @othercorey in #8228
- Improve inferring the "final"
static
type when calling static methods inside a different class by @someniatko in #8249 - fix triggerErrorExits not working by @kkmuffme in #8304
- Fixed ini_set types for arg value by @honca in #8308
- Add stub for DatePeriod by @fluffycondor in #8312
Internal changes
- Various minor improvements to speed up by ~10% by @kkmuffme in #8193
- chore: Set permissions for GitHub actions by @naveensrinivasan in #8189
- chore: Included githubactions in the dependabot config by @naveensrinivasan in #8203
- build(deps): bump mheap/github-action-required-labels from 1 to 2 by @dependabot in #8207
- build(deps): bump fkirc/skip-duplicate-actions from 3.4.0 to 4.0.0 by @dependabot in #8208
- build(deps): bump actions/cache from 2 to 3 by @dependabot in #8209
- build(deps): bump actions/checkout from 2 to 3 by @dependabot in #8210
- Allow testing expected CallMap return types by @othercorey in #8166
- Fix codestyle errors in InternalCallMapHandlerTest by @othercorey in #8220
- use error_log instead of trigger_error by @kkmuffme in #8243
- fix race conditions causing notices if directory does not exist by @kkmuffme in #8302
New Contributors
- @TimWolla made their first contribution in #8188
- @naveensrinivasan made their first contribution in #8189
- @dependabot made their first contribution in #8207
- @Tofandel made their first contribution in #8219
- @aszenz made their first contribution in #7994
- @someniatko made their first contribution in #8249
- @honca made their first contribution in #8308
Full Changelog: 4.24.0...v4.25.0
4.24.0
What's Changed
Features
- Infer object shape when array or scalar is cast to object by @theodorejb in #7935
- Improve @return annotation for implode() so that it can handle non-empty-array of non-empty-strings case by @hirokinoue in #7967
- Bugfix/#7912 class APCuIterator does not exist by @KevinVanSonsbeek in #7982
- Improve @psalm-internal and prevent usage of IssueBuffer::add(). by @AndrolGenhald in #8165
- Encapsed literal strings by @AndrolGenhald in #8164
Fixes
- fix missing is_a() parameter type by @staabm in #7951
- Improve array_unique callmap stubs by @mathroc in #7981
- Precise stat return type by @VincentLanglet in #8032
- Bugfix/splfileobject fputcsv invalidnamedargument by @KevinVanSonsbeek in #8042
- Fix
TypeCombiner::combine
to not modify TIntRange arguments. by @AndrolGenhald in #8049 - Coerce null to empty string in array keys by @weirdan in #8064
- Fix generic object comparison to use template constraint as default. by @AndrolGenhald in #8069
- Fix possibly empty array shape appearing non-empty (fixes #8048). by @AndrolGenhald in #8051
- fix #8099: ob_implicit_flush argument type changed to bool by @SamMousa in #8100
- number_format: allow third and forth parameters to be nullable by @drealecs in #8114
- Add ReflectionClass & ReflectionObject::isEnum() by @BenMorel in #8117
- Add missing ldap_unbind mapping for php 8.1 by @othercorey in #8126
- Fix signatures of ldap_* functions by @othercorey in #8147
- Fix datefmt_* function signatures by @othercorey in #8153
- Fix filter_var and filter_var_array signatures by @othercorey in #8152
- Fix array_* function signatures by @othercorey in #8151
- Add ReflectionProperty properties by @BenMorel in #8148
- Fix crash when redefining method with fewer params (fixes #8141). by @AndrolGenhald in #8174
Docs
- fix small error in plugins_type_system.md by @mathroc in #7914
- Clarify in docs that zero is not considered a positive-int by @bdsl in #8060
Internal changes
- Fix conflict of option -c with shell completion by @GromNaN in #7988
- change cache hash type for better performance by @kkmuffme in #7997
- micro-optimize condition by @kkmuffme in #8009
- igbinary_serialize code was missing in file by @kkmuffme in #8007
- Performance only load files once by @kkmuffme in #8011
- Fix syntax check failures by @weirdan in #8028
- Backport #7506 by @weirdan in #8027
- Run Shepherd with 8.0 by @weirdan in #8029
- Performance: cut the selected_text from snippet by @kkmuffme in #8055
- store origin location by ID to speed up psalm by up to 75% by @kkmuffme in #8054
- tests: add test that validates the callmap in the current runtime by @SamMousa in #8104
- Callmap validation ignore list cleanup by @SamMousa in #8144
Other changes
New Contributors
Full Changelog: 4.23.0...4.24.0