Releases: vimeo/psalm
Releases · vimeo/psalm
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
4.16.1
4.16.0
What's Changed
Removed
Codebase::$use_referencing_files
,Context::$possible_param_types
andFunctionLikeStorage::$template_covariants
were removed. We do not believe they were used by anyone, thus we don't consider it to be a BC break
Features
- Detect unused properties that are written to inside arrays by @muglug in #7129
- Allow operator overloading for Decimal extension (fixes #3938). by @AndrolGenhald in #7103
- Fix count_chars stubs by @kamil-tekiela in #7094
- Added support for first-class callables by @trowski in #7113
- Allow suppressing UnusedPsalmSuppress, remove unused suppressions. by @AndrolGenhald in #7133
- Forbid positional arg after named arg by @klimick in #7136
- in_array returns false in strict mode if types are incompatibles by @mathroc in #7141
- "No errors found!" message is now printed within a nice green block by @SMAtaurRahman in #7150
- Use igbinary for communication between processes if possible by @sj-i in #7162
- Add Set::map() to ext-ds stub by @simPod in #7156
- Improve project files discovery performance by @dvz in #7161
- allow marking enum cases as deprecated by @pilif in #7192
Fixes
- Fix non-empty-literal-string to behave as subtype of non-empty-string (fixes #7095). by @AndrolGenhald in #7105
- fix reconciliation between positive-int and inferior/superior assertions by @orklah in #7106
- don't stop analyzing array, even if we already have a type and we can't create an object like by @orklah in #7093
- fix missing case for displaying varId by @orklah in #7054
- array_count_values return type for uncertain arrays by @weirdan in #7115
- Class property issue suppression fixes. by @AndrolGenhald in #7130
- Fix type inference of closure params by @klimick in #7135
- Fix closure param type inference with named params by @klimick in #7139
- Post-assertions in loops by @klimick in #7143
- fix CI by @orklah in #7153
- Fix optional arguments in number_format (fixes #7158). by @AndrolGenhald in #7159
- Fix ldap_set_rebind_proc signature by @villfa in #7145
- Fixed compatibility with SoapClient by @yethee in #7140
- display class-strings in keyed arrays syntax and allow using them for assertions by @orklah in #7152
- ISSUE-5962 Fixed wrong line number for @method annotations by @nowaja in #7157
- Fix conflicting array_map return provider fake variables. by @AndrolGenhald in #7167
- Fix faulty comparison with typed closure by @muglug in #7175
- doesn't infer empty for ReflectionClass::getAttributes without params by @orklah in #7180
- Fixed ignoreTypeStats & useStrictTypes flag value detection for directories in config by @SMAtaurRahman in #7182
- fix #7178 again by @orklah in #7189
- fix other occurences of getAttributes by @orklah in #7190
- MySqli: some parameters are nullable by @igitur in #7186
- allow destructuring on a possible null variable as long as there is an array alongside by @orklah in #7193
- Added pure annotations to enum functions by @ricardoboss in #7194
- fix(stubs): UnitEnum::cases() can return an empty list by @azjezz in #7197
- Add early file filtering to
FileProvider::getFilesInDir()
by @dvz in #7201 - flag the context as "inside_conditional" when analyzing leftover cases to prevent emitting unused error by @orklah in #7203
- Restore attributes in ClassConstantStorage by @weirdan in #7217
Docs
Internal changes
- Remove useless chunk of code in ScopeAnalyzer by @muglug in #7097
- Use getSingleAtomic() instead of array_values(getAtomicTypes())[0]. by @AndrolGenhald in #7134
- fix some more expressions that can be replaced by getSingleAtomic by @orklah in #7137
- Fix parser cache files maintenance by @dvz in #7082
- Convertion of partials to full imports by @rarila in #7155
- Set allow-plugins for Composer 2.2 by @villfa in #7149
- Codingstyle: declare construct & namespace declaration by @rarila in #7165
- Remove superflous exclude pattern in phpcs.xml by @rarila in #7168
- Removed misleading parentheses after language construct by @kamil-tekiela in #7183
- fix wrong handling of flags in context by @orklah in #7195
- allow phpcodesniffer-composer-installer plugin by @orklah in #7205
- Workaround for PHPUnit process isolation issue with composer 2.2 by @weirdan in #7208
- Remove unused in-array assertions by @muglug in #7202
New Contributors
- @dvz made their first contribution in #7082
- @yethee made their first contribution in #7140
- @nowaja made their first contribution in #7157
- @igitur made their first contribution in #7186
Full Changelog: v4.15.0...4.16.0