Releases: vimeo/psalm
Releases · vimeo/psalm
4.23.0
What's Changed
Features
- Add configuration for maximum size of shaped array by @danog in #7433
- Disable filepath formatting as a link for Drone CI's output by @white43 in #7861
- cache statements even without persistent parser cache by @vognev in #7876
- Fix sort assert annotation by @hirokinoue in #7908
Fixes
- Register openssl_sign function to impure functions by @samsonasik in #7746
- update phpredis stubs by @kkmuffme in #7752
- DateInterval::createFromDateString can be false by @Ne-Lexa in #7758
- Allow null to ArrayAccess::offsetSet $offset param by @franmomu in #7759
- Fix #7750: array_column type inference by @mtk3d in #7760
- Improve int range parsing by @fluffycondor in #7775
- Fix #3036: make argument $read of internal PHP function stream_socket nullable. by @niconoe- in #7718
- PDOStatement::fetchAll() has incorrect type by @hc-jworman in #7785
- More attribute fixes. by @AndrolGenhald in #7788
- Avoid json_encode when serializing non-UTF8 literals by @ohader in #7791
- Add return shape for Throwable::getTrace by @ciaranmcnulty in #7798
- Fix ftp_fget/_fput/_nb_fget/_nb_fput stream arg type by @mrardon in #7824
- Fix namespaced min/max int range keyword issue introduced in #7775 by @AndrolGenhald in #7829
- Psalm considers most readline functions as pure, but they have side effects by @mstilkerich in #7828
- Avoiding double spaces (v2) by @ThomasLandauer in #7837
- Fix Incompatible types found for T (Stub&ProxyQueryInterface is not in ProxyQueryInterface&Stub) by @VincentLanglet in #7838
- Further improve Throwable::getTrace() return type by @hirokinoue in #7864
- Fix openssl_csr_export() signature by @mpesari in #7866
- don't emit issues when doing arithmetics on float templates by @hirokinoue in #7872
- Fix return type of
ldap_search
by @paulfedorow in #7894 - Alter order of baseline option loading to permit updating custom baseline by @M1ke in #7904
- improve LSP by @ging-dev in #7887
Docs
Internal changes
New Contributors
- @Ne-Lexa made their first contribution in #7758
- @mtk3d made their first contribution in #7760
- @hc-jworman made their first contribution in #7785
- @gndk made their first contribution in #7801
- @mrardon made their first contribution in #7824
- @hirokinoue made their first contribution in #7864
- @white43 made their first contribution in #7861
- @vognev made their first contribution in #7876
- @paulfedorow made their first contribution in #7894
- @ging-dev made their first contribution in #7887
Full Changelog: 4.22.0...4.23.0
5.0.0-beta1
What's Changed
Removed
- 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
Deprecations
Features
- Resolve DIR / FILE when const/variable is used for include by @tomasz-kusy in #7585
- add ReflectionIntersectionType stub by @orklah in #7621
- Allow config to define thread count (4.x) by @M1ke in #7633
- add phpredis stubs by @kkmuffme in #7614
- Add configuration option to disable @var parsing everywhere except for properties. by @danog in #7434
- 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
Fixes
- fix wrong detection of purity by @orklah in #7545
- Fix object constant inference by @klimick in #7542
- Handle first class callable on unknown functions by @orklah in #7546
- Revert "PHP 8.1: Report missing typehints in overridden native methods" by @weirdan in #7539
- Ensure
trait_exists()
always returnsbool
by @Ocramius in #7554 - sealed keyed arrays by @orklah in #7558
- AtomicStaticCallAnalyzer: clear tmp var from context by @vincent4vx in #7561
- improving error message for Could not resolve config path by @phptest2 in #7573
- Fix crash when assigning reference to unknown array offset by @AndrolGenhald in #7583
- Strip colours from success message by @weirdan in #7620
- Fix #6683 by improving simplification of CNF by @muglug in #7631
- Honour global function suppressions for UndefinedFunction by @weirdan in #7657
- Update return type for mysqli::connect_error by @morozov in #7660
- Correct name of ErrorException::__construct $line param by @chloekek in #7659
- Enum collapsing by @orklah in #7655
- Enum assertions by @orklah in #7662
- Consistency for empty reconciliations by @orklah in #7663
- Fix false positive for unused variable in try (fixes #7613). by @AndrolGenhald in #7664
- fix count with match on arrays by @orklah in #7665
- Prevent unnecessary filter_var() warnings on primitive types by @mmcev106 in #7677
- Throw exception if file_put_contents failed by @dmitryuk in #7690
- Improve bool to int casting. by @AndrolGenhald in #7696
- Fix issues with int range unpacking and with min/max by @AndrolGenhald in #7699
- Analyze attribute statements instead of constructing virtual statements. by @AndrolGenhald in #7692
- Fix some minor issues with references. by @AndrolGenhald in #7684
- Config threads: add to config.xsd by @M1ke in #7708
- Use current context when analyzing attributes by @AndrolGenhald in #7713
- Fix first-class callable in loop by @trowski in #7715
- Support for properties in interfaces extending
\UnitEnum
&\BackedEnum
by @whatUwant in #7719 - PDOException extends RuntimeException and can use int code errors by @VincentLanglet in #7673
- allow SimpleTypeInferer to infer non empty lists by @orklah in #7732
- Attribute analysis improvements by @AndrolGenhald in #7727
- 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
Docs
- doc about property initialization by @orklah in #7593
- Fix issue documentation links. by @AndrolGenhald in #7687
- Improve documentation for InvalidGlobal to explain that it's sometimes valid by @AndrolGenhald in #7693
- Fix int-mask-of doc example by @Seldaek in #7812
- Documented the allowMissingFiles attribute for ignoreFiles by @mmcev106 in #7867
Internal changes
- Fix extension capitalization issue, add extensions to version message. by @AndrolGenhald in #7574
- Added backward compatibility check by @weirdan in #7576
- Allow mocking final classes by @weirdan in #7591
- Fixed composer branch-alias by @sasezaki in #7594
- No longer require declare reflection-docblock:^5 as dependency by @sasezaki in #7612
- Bump up phpunit,prophecy, and introduced phpspec/prophecy-phpunit by @sasezaki in #7617
- consistency in AssertionFinder by @orklah in #7622
- skip a test because we removed the feature for now by @orklah in #7642
- Adjust for composer-require-checker check. by @sasezaki in #7632
- Removed .scrutinizer.yml by @sasezaki in #7652
- Use
array_fill_keys()
by @weirdan in #7661 - Fixed PSR-4 warnings by @weirdan in #7683
- chore: enable psl tests again by @azjezz in #7596
- Make callbacks marked as static by @SCIF in #6695
New Contributors
- @phptest2 made their first contribution in #7573
- @tomasz-kusy made their first contribution in #7585
- @chloekek made their first contribution in #7659
- @dmitryuk made their first contribution in #7690
- @whatUwant made their first contribution in #7719
- @Seldaek made their first contribution in #7812
- @dkemper made their first contribution in #7859
Full Changelog: 5.0.0-alpha1...5.0.0-beta1
4.22.0
What's Changed
Fixes
- Analyze attribute statements instead of constructing virtual statements. by @AndrolGenhald in #7692
- Config threads: add to config.xsd by @M1ke in #7708
- Use current context when analyzing attributes by @AndrolGenhald in #7713
- Fix first-class callable in loop by @trowski in #7715
- Support for properties in interfaces extending
\UnitEnum
&\BackedEnum
by @whatUwant in #7719 - PDOException extends RuntimeException and can use int code errors by @VincentLanglet in #7673
- allow SimpleTypeInferer to infer non empty lists by @orklah in #7732
- Attribute analysis improvements by @AndrolGenhald in #7727
New Contributors
- @whatUwant made their first contribution in #7719
Full Changelog: 4.21.0...4.22.0
4.21.0
What's Changed
Deprecations
Features
- Resolve DIR / FILE when const/variable is used for include by @tomasz-kusy in #7585
- add ReflectionIntersectionType stub by @orklah in #7621
- Allow config to define thread count (4.x) by @M1ke in #7633
- add phpredis stubs by @kkmuffme in #7614
- Add configuration option to disable @var parsing everywhere except for properties. by @danog in #7434
Fixes
- Strip colours from success message by @weirdan in #7620
- Honour global function suppressions for UndefinedFunction by @weirdan in #7657
- Update return type for mysqli::connect_error by @morozov in #7660
- Correct name of ErrorException::__construct $line param by @chloekek in #7659
- Fix false positive for unused variable in try (fixes #7613). by @AndrolGenhald in #7664
- Throw exception if file_put_contents failed by @dmitryuk in #7690
New Contributors
- @tomasz-kusy made their first contribution in #7585
- @kkmuffme made their first contribution in #7614
- @chloekek made their first contribution in #7659
- @dmitryuk made their first contribution in #7690
Full Changelog: 4.20.0...4.21.0
4.20.0
What's Changed
Deprecations
Fixes
- Fix for Exception->getCode return type provider by @VincentLanglet in #7525
- fix wrong detection of purity by @orklah in #7545
- Fix object constant inference by @klimick in #7542
- Handle first class callable on unknown functions by @orklah in #7546
- Revert "PHP 8.1: Report missing typehints in overridden native methods" by @weirdan in #7539
- Ensure
trait_exists()
always returnsbool
by @Ocramius in #7554 - sealed keyed arrays by @orklah in #7558
- AtomicStaticCallAnalyzer: clear tmp var from context by @vincent4vx in #7561
- improving error message for Could not resolve config path by @phptest2 in #7573
Internal changes
New Contributors
- @phptest2 made their first contribution in #7573
Full Changelog: 4.19.0...v4.20.0
5.0.0-alpha1
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
Deprecations
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
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 for Exception->getCode return type provider by @VincentLanglet in #7525
- Fix empty array by @orklah in #7517
- add back empty keyword by @orklah in #7533
Docs
- Dropped
html-escaped-string
docs by @weirdan in #7281 - Document BC breaks in #7358 by @weirdan in #7360
- Added documentation for baseline files by @ricardoboss in #7429
- Fix documentation for config. by @AndrolGenhald in #7564
- Fix bullet indentation in documentation by @AndrolGenhald in #7565
Internal changes
- Disable PSL (not yet compatible with Psalm 5) by @weirdan in #7269
- Require
@internal
annotation onPsalm\Internal
symbols by @weirdan in #7268 - Dropped deprecated
TypeAnalyzer
methods by @weirdan in #7277 - Moved
getPsalmHelpText()
toCli\Psalm
by @weirdan in #7280 - Replaced deprecated
webmozart/path-util
by @weirdan in #7292 - Indent heredoc by @weirdan in #7294
- Dropped dead code based on PHP_VERSION_ID by @weirdan in #7300
- Apply literal number separator rector by @weirdan in #7299
- Applied NullCoalescingOperatorRector by @weirdan in #7302
- Applied JsonThrowOnErrorRector by @weirdan in #7303
- Applied ListToArrayDestructRector by @weirdan in #7310
- replace
array<never, never>
as a way to detect empty arrays by a dedicated method by @orklah in #7313 - Applied ClosureToArrowFunctionRector by @weirdan in #7315
- Simplify object comparison by @muglug in #7340
- Rename was_static property to is_static to be more accurate by @muglug in #7358
- Add explicit
resolveSymlinks
option for project directories by @dvz in #7163 - Ensure that all entries in test arrays have explicit keys by @muglug in #7386
- TCallableString is non-falsy (0 can't be a functionlike name) by @orklah in #6521
- fix tests by @orklah in #7446
- Use objects, not strings, for assertions by @muglug in #7410
- Nitpicks by @orklah in #7448
- refactor description of types in Atomic by @orklah in #7409
- remove TPositiveInt usage for TIntRange by @orklah in #7472
- Update .gitattributes by @weirdan in #7522
- Fix ExceptionCodeTest provider shape by @weirdan in #7538
New Contributors
- @M1ke made their first contribution in #7442
- @petewalker made their first contribution in #7454
- @mal-tee made their first contribution in #7504
Full Changelog: 4.19.0...5.0.0-alpha1
4.19.0
What's Changed
Deprecations
- deprecate forbidEcho by @orklah in #6902
- Mark loadXdebugStub as deprecated (removed in #7107). by @AndrolGenhald in #7466
- deprecate TPositiveInt by @orklah in #7474
- Deprecate template_extended_count by @danog in #7494
Features
- Errors on superior/inferior reconciliation by @orklah in #7335
- PHP 8.2: seal all properties configuration by @danog in #7242
- Add support of template for docblock methods by @vincent4vx in #7385
- Resolve generics of inherited pseudo methods by @vincent4vx in #7430
- PHP 8.1: Report missing typehints in overridden native methods by @danog in #7363
- Add configuration option to disable
@psalm-suppress all
by @danog in #7431 - Add support of docblock method using parent keyword by @vincent4vx in #7414
Fixes
- Do not throw exception on xinclude with fallbacks by @vstm in #7324
- Update return type of iterator_count and iterator_apply functions to 0|positive-int by @ricardoboss in #7331
- replace class name by full FQN for scoper by @orklah in #7337
- Seal the array inferred for hrtime by @orklah in #7349
- set the is_list flag for the array inferred for hrtime by @orklah in #7350
- Fix dir Callmap by @VincentLanglet in #7347
- refactor the TooFewArguments check to start checking with named arguments by @orklah in #7348
- allow short closure to return never by @orklah in #7326
- keep class-strings through array_merge by @orklah in #7356
- fix: pass static class name to ReturnTypeAnalyzer by @Patrick-Remy in #7366
- Support multiple elements by @wouterj in #7354
- Fix closure to have storage bug in codeAction by @tm1000 in #7368
- Refactor Reconciler::handleLiteralEquality by @orklah in #7304
- Handle inherited docblock method by @vincent4vx in #7391
- Catch additional InvalidArgumentException by @tm1000 in #7384
- Combine positive int and range by @orklah in #7400
- Psalm can't be sure get_object_vars will return an empty array unless object is known AND final by @orklah in #7401
- support @readonly for promoted properties by @orklah in #7403
- Fix
self
parsing forpsalm-if-this-is
andpsalm-self-out
by @klimick in #7405 - Improve signature of random_bytes() by @villfa in #7406
- Improve signature of DOMDocument::loadXML() by @villfa in #7407
- Fix kafka stubs by @danog in #7426
- Fix Incomplete return type for mb_split() function by @RishiKumarRay in #7432
- fix proc_open stub for php >= 8.0 by @brainlock in #7443
- change nullable for array signature to be equal to param signature by @swiffer in #7301
- handle two more cases of firstClassCallable by @orklah in #7460
- fix internal properties on interfaces by @orklah in #7467
- Add Exception->getCode() return type provider by @VincentLanglet in #7390
- Fix
array_replace
type by @ElisDN in #7483 - Add missing parameter to Phar::getMetadata() by @villfa in #7486
- Bugfix/#6151 typedoesnotcontainnull on return value from dom import simplexml by @KevinVanSonsbeek in #7489
- BugFix: Made DOMNode::nodeValue nullable by @KevinVanSonsbeek in #7501
Docs
Internal changes
- replace empty checks on Union with dedicated method by @orklah in #7336
- Fix faulty Config tests by @wouterj in #7355
- Fix @Covers annotation. by @AndrolGenhald in #7374
- Add test for issues.md to ensure all documented issues are listed. by @AndrolGenhald in #7383
- remove psl analysis from CI by @orklah in #7397
- use Reconciler::RECONCILIATION_* by @orklah in #7398
- drop phpunit compatibility aliases by @orklah in #7435
Other changes
New Contributors
- @Patrick-Remy made their first contribution in #7366
- @vincent4vx made their first contribution in #7391
- @RishiKumarRay made their first contribution in #7432
- @KevinVanSonsbeek made their first contribution in #7489
Full Changelog: 4.18.1...4.19.0
4.18.1
4.18
Compatibility
Psalm now required Composer 2.
What's Changed
Deprecations
- Deprecated
Codebase::$php_major_version
andCodebase::$php_minor_version
properties by @weirdan in #7265 - Deprecated
THtmlEscapedString
by @weirdan in #7284
Features
- Template and variable types inference for methods marked with psalm-if-this-is by @klimick in #7259
- [Feat]: Initial Support for LSP Code Actions by @tm1000 in #7255
- Allow assertions on mutable object properties. by @AndrolGenhald in #7252
- Disallow ksorting lists by @danog in #7019
Fixes
- Remove "is not in project" warnings by @tm1000 in #7256
- Report missing file path properly by @simPod in #7266
- uniqid() returns a non-empty-string by @MidnightDesign in #7271
- pdo: more precise generic type by @staabm in #7274
- resolve ClassConstant for both sides in isContainedBy by @orklah in #7286
- Identify ints from TClassConstant when checking for LiteralEquality by @orklah in #7287
- resolve type alias and class const on UnionTypeComparator by @orklah in #7288
- Fix parse_url() return type by @villfa in #7293
- don't crash when pushing a template to in_array by @orklah in #7311
- Made all reflection classes implement Reflector by @donquixote in #7317
- fix empty string not quoted in keyed array offset by @orklah in #7309
- Prevented crashes on
array_map(...)
by @weirdan in #7321 - Fix analysis when __invoke() exists by @villfa in #7325
Internal changes
- Increase composer timeout by @weirdan in #7264
- Move from deprecated Composer 1 to Composer 2 runtime api by @DeyV in #7239
New Contributors
- @DeyV made their first contribution in #7239
- @MidnightDesign made their first contribution in #7271
- @donquixote made their first contribution in #7317
Full Changelog: 4.17.0...4.18
4.17.0
What's Changed
Features
- Fix first-class callables with built-in, magic, undefined methods and callable expressions by @trowski in #7232
Fixes
- quote more chars in keyed array names by @orklah in #7225
- handle literal equality with integer ranges by @orklah in #7224
- Allow XdebugHandler version 3 by @johnstevenson in #7211
- Improve CliUtils $argv handling by @vstm in #7210
- Fix closure param type inference in generic context by @klimick in #7200
- Fix @psalm-internal with trailing whitespaces by @sj-i in #7207
- add missing samesite array attribute by @swiffer in #7215
- Contextual inference for closure param types by @klimick in #7228
- allow suppressing unevaluatedCode by @orklah in #7236
- mysqli_fetch_object: added missing generic by @staabm in #7240
- Checking
psalm-if-this-is
before applyingpsalm-this-out
by @klimick in #7251 - allow calling mutation_free function inside a mutation_free context by @orklah in #7253
- Fixes #7246, wrap getTypeContextAtPosition in try/catch by @tm1000 in #7247
- forbid calling impure callable in immutable context by @orklah in #7260
- revert #7054 by @orklah in #7263
Internal changes
- remove always true/false conditions by @orklah in #7229
- code grooming by @orklah in #7230
- more code grooming by @orklah in #7233
- Speed up Windows tests by @weirdan in #7245
- Improve negated reconciliation logic by @muglug in #7261
New Contributors
- @johnstevenson made their first contribution in #7211
- @vstm made their first contribution in #7210
- @swiffer made their first contribution in #7215
Full Changelog: 4.16.1...4.17.0