1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-09 06:28:36 +01:00
Commit Graph

9551 Commits

Author SHA1 Message Date
Maximilian Bösing
6ca34fdd10
qa: adjust code for readability
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-04-03 02:23:59 +02:00
Maximilian Bösing
6455084198
qa: applied coding standard to existing code
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-04-01 14:57:20 +02:00
Maximilian Bösing
1d4f496d0d
feature: introduce value-of in assertions
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-04-01 14:57:20 +02:00
Daniel Leech
4fef4a2365 Move to basic configuration 2023-03-31 18:38:44 +01:00
Daniel Leech
8092554582 Add CLI help for the error-level option 2023-03-31 18:36:34 +01:00
orklah
8b9ad1eb9e
Merge pull request #9566 from DnwK98/handle-different-line-endings
Handle different line endings from baseline.
2023-03-29 23:38:21 +02:00
orklah
e2abc3e554
Merge pull request #9509 from ptomulik/issue-9506
Fixed #9506
2023-03-28 21:18:51 +02:00
Paweł Tomulik
ed1d095c7b
supress ComplexMethod 2023-03-28 20:59:51 +02:00
orklah
f78bf32417
Merge pull request #9570 from klimick/first-class-callable-contextual-inference
Contextual inference for first-class-callable
2023-03-28 20:40:04 +02:00
orklah
94f32e9718
Merge pull request #9323 from othercorey/fix-array-unique
Fix array_unique callmap
2023-03-28 20:27:18 +02:00
Corey Taylor
730bc221e9 Re-add array_unique() stub which preserved array type 2023-03-28 04:09:50 -05:00
orklah
6ca2f090d6
Merge pull request #9534 from fluffycondor/php8-str-function-signatures
Improve PHP8 str_* function signatures
2023-03-27 21:00:33 +02:00
Daniel Beardsley
7b541ed74f
src/Psalm/Config.php: don't use annotations
Psalm was parsing this as a property annotation, derp.
2023-03-27 09:48:36 -07:00
andrew
2b5faaa02f Fix psalm errors 2023-03-27 18:37:11 +03:00
andrew
72e5709ef2 Handle partially templated first-class-callables 2023-03-27 18:29:22 +03:00
Daniel Beardsley
ad05b138a5
ClassLikeNodeScanner.php: Fix missing $this
Derp!

Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
2023-03-27 08:14:46 -07:00
adrew
62a79eeff3 Test with invalid first-class-callable 2023-03-26 22:47:17 +03:00
adrew
f26c16d2ab Contextually resolve templates of first-class-callable arg during call 2023-03-26 19:07:20 +03:00
Daniel Beardsley
5ff933f2a5
@property annotations: allow *not* implying @psalm-seal-properties
Add a setting that allows usage of `@property` to *augment* classes that
use __get() and __set(). Previously, using `@property` once would force
you to exhaustively list all possible properties. This didn't use to be
the case, but was changed in df33405635

This was really unexpected for our team and for a while we thought it
was a psalm bug until I found the above commit.

We are using `__get()` for ORM objects and we want to use `@property` to
explicitly document some of columns without being forced to document
every column.
2023-03-24 23:35:41 -07:00
Damian Wójcik
350687dcb7 Handle different line endings from baseline. 2023-03-24 10:48:03 +01:00
orklah
dfd7ffc459 always combine the result of expansions 2023-03-23 20:51:34 +01:00
Bruce Weirdan
b25f2e6921
Fixed coercion of mixed into non-empty-mixed
Fixes vimeo/psalm#9540
2023-03-19 00:49:15 -04:00
Bruce Weirdan
2a84a63483
Prevent assertion leaks from else
Fixes vimeo/psalm#9395
2023-03-18 02:09:56 -04:00
fluffycondor
9730f2c073 Don't report InvalidLiteralArgument for paths 2023-03-18 00:05:44 +06:00
Paweł Tomulik
0e9f97ed61
make some shepherd tests to pass 2023-03-17 15:56:33 +01:00
Paweł Tomulik
7979ccc1d3
fixed #9605 for class-like compounds 2023-03-17 15:56:33 +01:00
Paweł Tomulik
4393493407
fixed #9605 for function-like compounds 2023-03-17 15:56:33 +01:00
orklah
531eec6df8
Merge pull request #9497 from ptomulik/issue-9496
Fixed #9496
2023-03-16 19:25:17 +01:00
Paolo Conizzoli
3ccb1eaffe
Fix MissingThrowsDocblock when documented interface is extended by thrown exception interface 2023-03-16 12:01:16 +01:00
Bruce Weirdan
70a024f5e3
Merge pull request #9519 from edsrzf/eval-inside-call 2023-03-15 15:47:58 -04:00
Evan Shaw
37ff3a0657 Remove always-empty ClassAnalyzer leftover_stmts array 2023-03-16 07:03:10 +13:00
Evan Shaw
ce3f7fccd6 Set inside_call for eval expressions 2023-03-15 22:06:36 +13:00
Bruce Weirdan
c272be1e04
Merge pull request #9499 from weirdan/fix-integer-overflow-in-array-keys 2023-03-14 22:43:11 -04:00
Bruce Weirdan
9b00049d05
Merge pull request #9491 from weirdan/support-numeric-literal-separators-in-docblocks 2023-03-14 22:20:24 -04:00
Bruce Weirdan
8d71479f2f
Merge pull request #9504 from othercorey/fix-strsplit 2023-03-14 22:19:52 -04:00
Bruce Weirdan
c7c0b79903
Merge branch 'master' into fix-integer-overflow-in-array-keys 2023-03-14 22:17:04 -04:00
orklah
293b7281f9
Merge pull request #8960 from tm1000/feature/upgrade-lsp-v5
WIP: Performance/Feature Improvements to the Language Server
2023-03-14 07:31:35 +01:00
Bruce Weirdan
1a5a9d2242
Fix asserted property mangling
Fixes vimeo/psalm#9505
2023-03-13 02:15:21 -04:00
Paweł Tomulik
f61ffe4e27
Merge branch 'pvandommelen-issue-9496' into issue-9494-merged 2023-03-13 05:56:37 +01:00
Corey Taylor
39bb7b45a7 Fix return type of str_split() 2023-03-12 21:15:53 -05:00
Bruce Weirdan
971b93049f
Update src/Psalm/Type/Atomic/TKeyedArray.php
Co-authored-by: MoonE <maxi_kroeg@web.de>
2023-03-12 20:35:21 -04:00
Bruce Weirdan
4042036e8e
Drop misleading type 2023-03-12 20:12:19 -04:00
Bruce Weirdan
30369e826a
Correctly handle near-overflowing keys and flag autoincrement overflows
Co-authored-by: Maximilian Krög <maxi_kroeg@web.de>
2023-03-12 19:57:14 -04:00
Peter van Dommelen
6bbcfb2429 Reuse the normal docblock-type parser when parsing type aliases instead of doing regex magic.
Fixes #9496.
Also resolves an additional issue with comments after a type which does not contain brackets.
Includes a test for multiline types which did not yet exist.
2023-03-12 22:58:20 +01:00
Bruce Weirdan
0e9085f3e0
Handle overflow in SimpleTypeInferer as well 2023-03-12 17:47:42 -04:00
Bruce Weirdan
902a019f0a
Merge pull request #9406 from edsrzf/atomic-constructor 2023-03-12 17:27:22 -04:00
Bruce Weirdan
103aa019da
Fix integer overflow in array keys
Fixes vimeo/psalm#9498
2023-03-12 16:20:13 -04:00
Paweł Tomulik
84b389e738
workaround for false positives caused by #9484 2023-03-12 18:23:10 +01:00
Paweł Tomulik
232791753d
fix #9433 2023-03-12 18:23:10 +01:00
Bruce Weirdan
47f792ea12
Deprecate CallableTrait::__construct
All internal consumers have their own constructors now, and we don't
expect external classes to use it.
2023-03-12 03:33:26 -04:00
Evan Shaw
3b3d07e555
Add back CallableTrait constructor 2023-03-12 03:33:26 -04:00
Evan Shaw
f5c3f08f8e
Make Atomic subclasses consistently call their parent constructors 2023-03-12 03:33:25 -04:00
Bruce Weirdan
b37c56613b
Support int separators in docblocks
PHP understands `1_000` to be `1000`, so there's no reason why it
shouldn't be recognized in docblocks as well.
2023-03-11 23:14:40 -04:00
Bruce Weirdan
f48b79063c
Merge pull request #9486 from ZebulanStanphill/fix-truthy-string-analysis 2023-03-11 22:06:14 -04:00
Bruce Weirdan
8adaee61ad
Fix newly found issues 2023-03-11 05:23:49 -04:00
Bruce Weirdan
46493ab358
Compare list generic params
So that `list<int>` does not accept `list{1, new stdClass}`

Fixes vimeo/psalm#9485
2023-03-11 05:23:49 -04:00
Zebulan Stanphill
d7d5f72045
Add truthy-string to reserved word list. 2023-03-10 22:07:43 -06:00
Pere Orga
f70b375da3 Remove unused 'use function version_compare' 2023-03-08 20:35:43 +01:00
Pere Orga
187c214f58 Use analysis_php_version_id instead of config->getPhpVersion() 2023-03-08 20:33:55 +01:00
Pere Orga
17939eda04 consider new HTML entity en/decode functions defaults since PHP 8.1 2023-03-08 18:57:22 +01:00
Bruce Weirdan
193a0dbe0e
Don't crash on unary minus overflow
Fixes vimeo/psalm#9464
2023-03-07 12:29:40 -04:00
Bruce Weirdan
91cd660286
Fix CS 2023-03-06 05:33:26 -04:00
Alessandro Lai
7f26a5b473
Replace requirement for package-versions with Composer 2 APIs 2023-03-06 09:21:44 +01:00
Peter van Dommelen
c72edefc9e Do not strip the last ) bracket when parsing phpdoc type aliases.
Fixes https://github.com/vimeo/psalm/issues/6782

Reworked the regex logic to not check each grouping character separately. Removed the `^` character from the character list, which was likely unintended.
2023-03-05 22:28:22 +01:00
Bruce Weirdan
f801561ea7
Improce enum case reconciliation
Fixes vimeo/psalm#9456
2023-03-05 16:34:51 -04:00
Andrew Nagy
3271b1b8f3 add experimental in memory option 2023-03-03 08:11:10 +00:00
Bruce Weirdan
36913b13d5
Support for readonly classes 2023-03-03 04:04:12 -04:00
Andrew Nagy
f908b9ad85 fix failing test 2023-03-03 07:20:41 +00:00
Bruce Weirdan
98d96fbe9c
Forbid private final methods
Fixes vimeo/psalm#8374
2023-03-03 02:00:09 -04:00
Andrew Boyton
e8bd52eba6 Merge param descriptions when adding or updating types 2023-03-03 08:32:24 +11:00
Andrew Nagy
97eae625e9 fixes 2023-03-02 19:12:29 +00:00
Andrew Nagy
7760c399cc syntax 2023-03-02 19:05:14 +00:00
Andrew Nagy
fc4c98050e cleanup 2023-03-02 19:02:56 +00:00
Andrew Nagy
221eecf2e3 remove options to clear and boot cache 2023-03-02 18:57:27 +00:00
Andrew Nagy
24b6a97891 use in-memory cache thanks @ging-dev, remove pnctl fork 2023-03-02 18:45:23 +00:00
Andrew Nagy
0e4b878cbe fix outstanding issues 2023-03-02 18:14:20 +00:00
Andrew Nagy
7e9638b729 Merge branch 'master' of https://github.com/vimeo/psalm into feature/upgrade-lsp-v5 2023-03-02 18:10:13 +00:00
Andrew Nagy
3467816900 fix 2023-03-02 18:07:50 +00:00
Andrew Nagy
5eed370fa5 fix outstanding CI issues 2023-03-02 18:02:23 +00:00
Andrew Nagy
2efd9c81e0 bump to 5.7.7 2023-03-02 17:05:12 +00:00
Andrew Nagy
6e109aadce Merge tag '5.7.7' of https://github.com/vimeo/psalm into feature/upgrade-lsp-v5 2023-03-02 17:04:33 +00:00
Bruce Weirdan
839dc10da2
Merge pull request #9435 from vimeo/revert-9434-array_pop-is-impure 2023-03-01 01:48:26 -04:00
orklah
83051cfe87
Merge pull request #9291 from lptn/disableExtensions-hides-warnings
Do not display ext deprecation note when `disableExtensions` used
2023-03-01 00:06:59 +01:00
Bruce Weirdan
5130563d9f
Revert "array_pop is impure" 2023-02-28 19:06:07 -04:00
Bruce Weirdan
007ffaecd8
array_pop is impure
Fixes vimeo/psalm#9429
2023-02-28 18:53:36 -04:00
Alies Lapatsin
fcb96f10c2 Fix default for ibm_db2 ext, add description 2023-02-28 23:05:47 +01:00
Alies Lapatsin
feb0cb8598 Merge branch 'master' into disableExtensions-hides-warnings
# Conflicts:
#	src/Psalm/Config.php
2023-02-28 22:51:43 +01:00
Paweł Tomulik
78e6545d7f
fix #4460 2023-02-28 11:38:47 +01:00
orklah
99b598716d
Merge pull request #9422 from EgorBakulin/#9411/concat-should-never-remove-non-empty-non-falsy-from-string
concat should never remove non empty non falsy from string #9411
2023-02-27 18:49:24 +01:00
ebakulin
67d26d3c51 added case with literal string 2023-02-28 00:22:34 +07:00
ebakulin
cf35b3ce0c reworked one known operand case 2023-02-28 00:12:18 +07:00
ebakulin
31fcbd5f69 added case with one null type 2023-02-27 22:03:01 +07:00
Paweł Tomulik
69c5fd69f3
fixed #9401 2023-02-27 00:07:58 +01:00
Bruce Weirdan
e743cd9e8d
Taint map is non-empty as well 2023-02-26 03:17:13 -04:00
Bruce Weirdan
6811547707
Callmap is always non-empty
Fixes several baselined issues
2023-02-26 02:45:46 -04:00
Alies Lapatsin
c23cb4bdf0
Merge branch 'master' into php83-dic 2023-02-25 11:14:00 +01:00
Alies Lapatsin
02de61eabe Update PHP_MINOR_VERSION 2023-02-25 11:13:04 +01:00
Bruce Weirdan
6ac2b8d5a8
Merge pull request #9400 from edsrzf/psalter-possibly-undefined 2023-02-25 04:26:56 -04:00
Evan Shaw
f7eaa5daec Preserve PossiblyUndefinedVariable when fixing UnusedVariable 2023-02-25 20:08:01 +13:00
Bruce Weirdan
99a69b463c
Merge pull request #9398 from gndk/grpc-extension 2023-02-24 22:21:28 -04:00
gndk
fd2b439e6f Only disable grpc extension if it is not properly configured 2023-02-25 02:46:56 +01:00
Bruce Weirdan
59e549d2e8
Merge branch '5.7.x' into master 2023-02-24 21:19:43 -04:00
Bruce Weirdan
38d1abc13a
Don't crash on empty jit_buffer_size
Fixes vimeo/psalm#9396
2023-02-24 20:38:15 -04:00
Javier Spagnoletti
ab13ddf286 [ibm_db2] Improve return type inference for db2_autocommit() 2023-02-24 19:53:42 -03:00
Bruce Weirdan
682943423e
Merge branch '5.7.x' into master 2023-02-24 15:54:48 -04:00
Yannick Gottschalk
0a0f900d4c Fixed codestyle and psalm errors 2023-02-24 15:27:17 +01:00
Yannick Gottschalk
ad5bf62094 Fixes #9373 2023-02-24 13:32:04 +01:00
Yannick Gottschalk
98d3514197 Refs #9373, partial fix 2023-02-24 10:17:27 +01:00
Bruce Weirdan
caac14c4a4
Consistently report docblock issues on all classlikes
Fixes vimeo/psalm#9365
2023-02-24 03:31:00 -04:00
Bruce Weirdan
5f59f07163
Allow array as magic method name
Fixes vimeo/psalm#9321
2023-02-24 02:23:09 -04:00
Bruce Weirdan
3f52ded9c3
Correctly process use aliases in @psalm-scope-this
Fixes vimeo/psalm#9386
2023-02-24 00:53:36 -04:00
Bruce Weirdan
ea32d203b6
Disable opcache.preload if it's enabled
Fixes vimeo/psalm#9382

Also reorganized the opcache settings check a bit and enforced
`opcache.jit_buffer_size`
2023-02-23 22:17:23 -04:00
Bruce Weirdan
2315c98a73
Merge pull request #9381 from weirdan/enforce-literal-string-length-limit 2023-02-23 16:47:53 -04:00
Yannick Gottschalk
f026226aa3 Fixes #9384 2023-02-23 17:23:46 +01:00
Bruce Weirdan
5dec7f3dc3
Enforce literal string length limit
Fixes vimeo/psalm#9376

Ensures:
* that we never have a literal string exceeding the length limit
* that we call string interpreter for all literal strings
2023-02-23 04:01:29 -04:00
Bruce Weirdan
e96a929451
Merge pull request #9383 from weirdan/process-psalm-api-on-methods 2023-02-23 04:00:42 -04:00
Bruce Weirdan
2e90cb6c6a
Process @psalm-api tags on methods 2023-02-23 03:52:10 -04:00
Bruce Weirdan
d0a14005a8
Merge pull request #9380 from weirdan/array-in-foreach-is-not-empty 2023-02-23 02:20:46 -04:00
Bruce Weirdan
a26d3edb73
Fix newly found issue 2023-02-22 21:16:33 -04:00
Bruce Weirdan
1769f8b9a4
Refine arrays in foreach loops to non-empty-array
Fixes vimeo/psalm#9378
2023-02-22 20:44:50 -04:00
Javier Sanahuja
bf56db7623 Fixes 2023-02-23 01:40:30 +01:00
Javier Sanahuja
aee3665014 Fixes 2023-02-22 23:55:27 +01:00
Javier Sanahuja
fa39366cb4 Code style fix 2023-02-22 23:19:47 +01:00
Javier Sanahuja
4f83324a91 Support sizeof alias of count 2023-02-22 23:11:10 +01:00
Alies Lapatsin
e6bcd054b1 Merge branch 'master' into simplify-shepherd 2023-02-22 02:55:40 +01:00
f665e719fb
Describe changes 2023-02-21 15:44:18 +01:00
Alies Lapatsin
df00fd17fc Fix coding style issues 2023-02-21 12:49:19 +01:00
Alies Lapatsin
609c426133 Add DeprecatedMethod suppression 2023-02-21 12:40:23 +01:00
Alies Lapatsin
46c486b271 Fix output formatting 2023-02-21 12:16:11 +01:00
Alies Lapatsin
124569c8ef Display debug info for all error responses 2023-02-21 12:13:52 +01:00
Alies Lapatsin
cabeb5b983 Bypass output overlap
like:

Shepherd error: https://custom-host.shepherd/hooks/psalm endpoint responded with 0 HTTP status code.
array (
Shepherd response: n/a
  'url' => 'https://custom-host.shepherd/hooks/psalm',
Please check shepherd endpoint — it should be a valid URL. cURL Debug info:
  'content_type' => NULL,

  'http_code' => 0,
  'header_size' => 0,
  'request_size' => 0,
  'filetime' => -1,
  'ssl_verify_result' => 0,
  'redirect_count' => 0,
  'total_time' => 0.025202,
  'namelookup_time' => 0.0,
  'connect_time' => 0.0,
  'pretransfer_time' => 0.0,
  'size_upload' => 0.0,
  'size_download' => 0.0,
  'speed_download' => 0.0,
  'speed_upload' => 0.0,
  'download_content_length' => -1.0,
  'upload_content_length' => -1.0,
  'starttransfer_time' => 0.0,
  'redirect_time' => 0.0,
  'redirect_url' => '',
  'primary_ip' => '',
  'certinfo' =>
  array (
  ),
  'primary_port' => 0,
  'local_ip' => '',
  'local_port' => 0,
  'http_version' => 0,
  'protocol' => 0,
  'ssl_verifyresult' => 0,
  'scheme' => '',
  'appconnect_time_us' => 0,
  'connect_time_us' => 0,
  'namelookup_time_us' => 0,
  'pretransfer_time_us' => 0,
  'redirect_time_us' => 0,
  'starttransfer_time_us' => 0,
  'total_time_us' => 25202,
  'effective_method' => 'POST',
)
2023-02-21 12:04:18 +01:00
Alies Lapatsin
6603d84dfb Display debuging info for a 0 cURL HTTP status response 2023-02-21 11:56:57 +01:00
Alies Lapatsin
66ce363431 Prepend URL scheme for th legacy host 2023-02-21 11:13:20 +01:00
Alies Lapatsin
b78472c752 Display $endpoint on error message (simplify debugging) 2023-02-21 10:59:31 +01:00
575da79801 Fix #9363 2023-02-21 10:09:58 +01:00
Alies Lapatsin
6ba9b1bb17 Merge branch 'master' into simplify-shepherd 2023-02-21 09:30:21 +01:00
Bruce Weirdan
ac86981a79
Revert "#7387 Add asserting non-empty-string by strlen"
This reverts commit 0ef7ec100a.
2023-02-20 23:07:22 -04:00
Evan Shaw
a03299f3d0 Include setrawcookie as an impure function 2023-02-21 14:24:05 +13:00
Bruce Weirdan
471a8c6a1d
Merge pull request #9354 from othercorey/fix-php74 2023-02-20 18:34:36 -04:00
Corey Taylor
c23de496cf Replace use of DOMParentNode::append() with appendChild() 2023-02-20 14:45:04 -06:00
88a3d288de Workaround arm64 opcache bug (fixes #9350) 2023-02-20 12:49:59 +01:00
Alies Lapatsin
547dfb4237 Merge branch 'master' into simplify-shepherd 2023-02-20 10:52:02 +01:00
Ismail Turan
bec8ddf525 fix (DateTime|DateTimeImmutable)::modify() return types
vimeo#9042 caused issues to any called method on an instance
of DateTime|DateTimeImmutable after calling the modify
method.

This fixes vimeo#9171
2023-02-20 08:47:05 +01:00
Bruce Weirdan
1b0f322bc7
Fix PsalmRestarter::restart() signature
XdebugHandler v2 did not have the param type hint

Fixes vimeo/psalm#9345
2023-02-19 20:38:03 -04:00
5df21fe448 Always use 0x7FFEBFFF opcache optimization level (fixes #9340) 2023-02-19 16:57:23 +01:00
Evan Shaw
a25fe35584 Negated is_numeric narrows scalar type 2023-02-19 22:38:34 +13:00
Bruce Weirdan
73bad8967d
Forbid first-class callables in new
It's an invalid construct in PHP, not rejected by PHPParser for some
reaason.

Fixes vimeo/psalm#9335
2023-02-19 04:18:32 -04:00
Evan Shaw
c8393bd50d Fix language server first-class callable crashes 2023-02-19 14:18:17 +13:00
Bruce Weirdan
5fe902bde5
Merge pull request #9326 from vimeo/prevent-jit-warnings 2023-02-18 18:22:59 -04:00
Gregor Harlan
80e781315a
RedundantCast 2023-02-18 12:58:40 +01:00
Bruce Weirdan
4f22c2e7c6
Propagate phantom classes to closure context
Fixes vimeo/psalm#9317
2023-02-18 01:52:10 -04:00
Bruce Weirdan
4d871fd241
Disable JIT-incompatible extensions to prevent warnings
This also enables JIT for `psalter` and syncs the list of disabled
extensions between `psalm`, `psalter` and `psalm-language-server`
2023-02-17 15:32:37 -04:00
Alies Lapatsin
d805f80f95 Merge branch 'master' into simplify-shepherd 2023-02-16 11:12:24 +01:00
Alies Lapatsin
2ddc54331d Merge branch 'master' into disableExtensions-hides-warnings 2023-02-16 10:55:38 +01:00
Bruce Weirdan
1c2bc49838
Forbid non-null defaults for callable parameters
Fixes vimeo/psalm#3284
2023-02-16 01:36:06 -04:00
Bruce Weirdan
cd5b743d6b
Fix newly found issues 2023-02-15 22:18:30 -04:00
Bruce Weirdan
e6aa63731d
Flag docblock parameters that have no counterparts in function signature
Fixes vimeo/psalm#3166
2023-02-15 22:04:26 -04:00
Bruce Weirdan
01911a06b7
Deprecate FunctionLikeStorage::$unused_docblock_params
Refs vimeo/psalm#3166
2023-02-15 21:29:20 -04:00
Bruce Weirdan
ee823619b8
Flag direct constructor calls
Fixes vimeo/psalm#2975
2023-02-15 20:14:00 -04:00
Alies Lapatsin
9e9629c474 Fix check for supported php-ext 2023-02-15 22:34:06 +01:00
Alies Lapatsin
4da3252886
Merge branch 'master' into disableExtensions-hides-warnings 2023-02-15 22:01:38 +01:00
Bruce Weirdan
c28d96e25c
Fixed issue message for missing @psalm-external-mutation-free
Fixes vimeo/psalm#8604
2023-02-15 03:58:50 -04:00
Bruce Weirdan
2bb590feb6
Allow suppressing MissingThrowsDocblock for individual exceptions
Fixes vimeo/psalm#8638
2023-02-15 03:29:02 -04:00
Bruce Weirdan
8c491e93e8
Flag class constant references where LHS is ordinary string
Fixes vimeo/psalm#2185
2023-02-15 02:57:00 -04:00
Bruce Weirdan
3f2ecaec7e
Allow @var annotations on global vars
The actual code was extracted from `StaticAnalyzer`

Fixes vimeo/psalm#1111
2023-02-15 01:20:03 -04:00
Bruce Weirdan
1ab02125b0
Added issue type and psalm.dev link to Emacs report
Fixes vimeo/psalm#8331
2023-02-14 21:19:29 -04:00
Alies Lapatsin
766d1487a9
Merge branch 'master' into disableExtensions-hides-warnings 2023-02-14 20:53:54 +01:00
Alies Lapatsin
f1e04f2dc3 Reorganize Shepherd logic to improve redability and support custom endpoint 2023-02-14 20:01:37 +01:00
Alies Lapatsin
cfa4450394 Do not display ext deprecation note when disableExtensions used
Fixes #8958
2023-02-14 12:34:49 +01:00
Bruce Weirdan
39c992c255
Emit issues for calls to is_a(string, class-string, false)
Fixes vimeo/psalm#4092
2023-02-14 02:25:46 -04:00
Bruce Weirdan
cee90fc071
Compare enum cases thoroughly
Fixes vimeo/psalm#7814
2023-02-13 22:39:33 -04:00
b54cefe33f
Emit warning if the opcache cannot be installed or JIT cannot be used 2023-02-13 18:32:54 -04:00
Bruce Weirdan
873d79c5d7
Forbid overriding built-in enum methods
Fixes vimeo/psalm#9274
2023-02-13 00:37:59 -04:00
Bruce Weirdan
08f5b3592e
Merge pull request #9265 from weirdan/fix-opcache-loaded-twice 2023-02-12 22:42:44 -04:00
Bruce Weirdan
085e8f6fb2
Forbid implementing some interfaces
- `Throwable` can only be implemented when classes extend one of
  `Exception` or `Error`
- `UnitEnum` and `BackedEnum` cannot be implemented by user-defined
  classes

Refs vimeo/psalm#7722
2023-02-12 02:48:50 -04:00
orklah
93267f298b
Merge pull request #9253 from kkmuffme/fix-lstat-bug-when-removing-cache-dir
fix lstat bug cache directory race condition
2023-02-11 12:24:00 +01:00
Bruce Weirdan
528ac003ce
Do not try tweaking JIT if it's not available 2023-02-11 07:04:17 -04:00
Bruce Weirdan
542cc343fc
Fix opcache being loaded twice
Fixes vimeo/psalm#9263
2023-02-11 06:42:48 -04:00
Bruce Weirdan
85d4acf3b3
Fix crash when int range boundary is overflown
Fixes vimeo/psalm#9114
2023-02-09 22:57:57 -04:00
Bruce Weirdan
954136679a
Fix crashes with invalid @psalm-check-type syntax
Fixes vimeo/psalm#9201
2023-02-09 17:49:49 -04:00
kkmuffme
78c3d6b436 fix lstat bug cache directory race condition 2023-02-09 09:27:51 +01:00
Bruce Weirdan
7ae8f9f24c
Merge pull request #9250 from weirdan/dont-crash-on-unknown-exceptions-in-throws-docblock
Fixes https://github.com/vimeo/psalm/issues/9248
2023-02-09 03:34:11 -04:00
Bruce Weirdan
250d4d593e
Don't crash on unknown exceptions in @throws docblock
Fixes vimeo/psalm#9248
2023-02-09 02:56:01 -04:00
Andrew Boyton
5d976900d1 Fix divide by a floating point zero
The code was failing when dividing by 0.0.
2023-02-09 11:55:06 +11:00
d7e0bc5d25 Always enable JIT 2023-02-07 18:13:41 +01:00
Bruce Weirdan
3c4a829f71
Fixed more CS issues 2023-02-07 11:20:02 -04:00
kkmuffme
9346b7f74b find_unused_code CLI arg should not be overwritten by config file 2023-02-07 11:31:46 +01:00
Matthew Brown
d450b40da8
Remove some logic that didn't need to be there (#9209)
* Remove check to see what breaks

* Simplify following logic

* Add tests from @kkmuffme‘s branch

* Reduce scope of fix

* Clean up logic a little

* Add failing test

* Improvements

* Fix for non-Paradoxical Condition result
2023-02-03 21:08:16 -05:00
Matt Brown
234787bcd6 Fix logic bugs caught by better elseif checks 2023-02-03 00:30:42 -05:00
orklah
54cd529642
Merge pull request #9170 from mmcev106/filter-var-pure
Added @psalm-pure to filter_var()
2023-02-02 23:39:06 +01:00
Alies Lapatsin
a5a2daa993 Use early return 2023-02-02 22:15:26 +01:00
orklah
a56e08d4ff
Merge pull request #9207 from ging-dev/master
fix `didChange` event in LSP
2023-02-02 19:35:11 +01:00
Bruce Weirdan
fb65c79079
Fix newly discovered CS issues 2023-02-02 12:19:22 -04:00
ging-dev
79c3779033 fix didChange event in LSP 2023-02-02 16:41:10 +07:00
Mark McEver
77ea545244 Attempted to avoid a psalm warning that was not accurate 2023-02-01 15:50:36 -06:00
Mark McEver
b5781c34e8 Fixed a case where the conditional taint, specialize, & flow features were not playing nicely together 2023-02-01 15:41:52 -06:00
Leo Viezens
7966fd574a
Merge branch 'master' into master 2023-01-30 15:38:29 +01:00
Alies Lapatsin
d49b35c92a
Merge branch 'master' into unify-deprecation-messages 2023-01-26 23:02:59 +01:00
Andrew Nagy
3c38e02b62 allow dynamically changing configuration without restarting 2023-01-26 09:40:07 +00:00
Andrew Nagy
468e7e7d45 add cli command to turn off xdebug turnoff functionality, fix bug with docblock 2023-01-26 09:12:43 +00:00
Andrew Nagy
27c0caf2fb Fixes #9180 allow baseline file 2023-01-25 18:13:27 +00:00
orklah
aec0edc618
Merge pull request #9177 from Nicelocal/duplicate_keys
Detect duplicate keys in array shapes
2023-01-25 18:37:22 +01:00
Andrew Nagy
b14ed73c0b Merge tag '5.6.0' into feature/upgrade-lsp-v5 2023-01-25 17:08:24 +00:00
Bruce Weirdan
0682adf3e4
Merge pull request #9173 from shvlv/feature/support-class-constants-for-phpstorm-meta-override 2023-01-25 12:31:17 -04:00
Jack Worman
375cdeb636 cdata in baseline 2023-01-25 10:57:28 -05:00
Jack Worman
32581a71fd cdata in baseline 2023-01-25 10:54:33 -05:00
40a05d574a Improve error messages 2023-01-25 12:26:59 +01:00
247d30f74c Detect duplicate keys in array shapes 2023-01-25 10:42:05 +01:00
shvlv
eca7079982
Fix Psalm errors 2023-01-25 11:32:41 +02:00
shvlv
6227943bfb
Allow to scan private constants 2023-01-24 13:31:58 +02:00
shvlv
d6aff3ed20
Parse class constant for PhpStorm Meta override 2023-01-24 12:24:52 +02:00
Alies Lapatsin
9d54de6a51 Use a new method to display warning 2023-01-24 06:50:09 +01:00
Alies Lapatsin
0cc770c947 Use a new method to display warning 2023-01-24 06:48:03 +01:00
Alies Lapatsin
b667db20e6 Merge branch 'master' into unify-deprecation-messages 2023-01-24 06:41:43 +01:00
Alies Lapatsin
68842a50c5 Use STDERR for Shepherd output, fixes #9168 2023-01-23 21:14:18 +01:00
Bruce Weirdan
f0df1192c4
Merge pull request #9164 from weirdan/do-not-allow-this-in-static-closures
Fixes https://github.com/vimeo/psalm/issues/9148
Fixes https://github.com/vimeo/psalm/issues/2813
2023-01-23 12:51:50 -04:00
Bruce Weirdan
bfce3a41e4
Closures that use $this should not be static 2023-01-23 05:47:11 -04:00
Bruce Weirdan
70f2fb7d1b
Check $this in static closures
Fixes vimeo/psalm#9148
Fixes vimeo/psalm#2813
2023-01-23 05:16:12 -04:00
Maarten Buis
2065f625cb
HEAD in all caps 2023-01-23 08:42:54 +01:00
Bruce Weirdan
2af7f51394
Suppress warnings when --no-output is specified 2023-01-22 20:40:21 -04:00
Alies Lapatsin
73f90229bb
Merge branch 'master' into fix-shepherd-without-custom-domain 2023-01-22 13:03:40 +01:00
Anner Visser
d86fcf4a85
Narrow ->value of enum case(s) to only the possible values
Using $stmt_var_type to determine if we're dealing with a subset of the
enum cases. If so, we only consider those cases for the possible values.

Fixes #8568
Fixes #8812
2023-01-21 12:05:24 +01:00
Alies Lapatsin
ca063a46d9 Use more readable for Psalm expressions 2023-01-20 09:39:39 +01:00
Alies Lapatsin
e3e1c92c07 Fix shepherd for default domain
When you run `psalm` like `psalm --shepherd`,
$options['shepherd'] === false
2023-01-18 21:28:01 +01:00
Alies Lapatsin
089b388c91 Unify deprecation messages 2023-01-18 21:19:30 +01:00
Alies Lapatsin
a1a2ecc957
Merge branch 'master' into unify-deprecation-messages 2023-01-18 21:14:02 +01:00
Alies Lapatsin
a28d825476 Do not display "Enabled extensions: " for empty ext list 2023-01-18 20:55:14 +01:00
Alies Lapatsin
2f385a9057 Unify deprecation messages 2023-01-18 20:54:49 +01:00
Alies Lapatsin
e6ea61c91b Enhance error output for shephed 2023-01-18 19:59:09 +01:00
Alies Lapatsin
aac6ead2d9 Fix coding style issues 2023-01-18 19:06:51 +01:00
Alies Lapatsin
363a0b6b22 Add suppressions for using a deprecated property 2023-01-18 19:06:51 +01:00
Alies Lapatsin
d5e5dc0683 Fully support Psalm 5 behaviour
asked by orklah, see
https://github.com/vimeo/psalm/pull/9112#issuecomment-1383239821
2023-01-18 19:06:51 +01:00
Alies Lapatsin
291484df44 Return getCurlErrorMessage() method as it can be used outside 2023-01-18 19:06:51 +01:00
Alies Lapatsin
8e5715875a Update cli help text 2023-01-18 19:06:51 +01:00
Alies Lapatsin
587ac6e018 Fix coding style issues 2023-01-18 19:06:51 +01:00
Alies Lapatsin
c95b0718c4 Properly process HTTP response codes from shepherd servers 2023-01-18 19:06:51 +01:00
Alies Lapatsin
09517d3176 Follow redirects when submitting shepherd reports 2023-01-18 19:06:51 +01:00
Alies Lapatsin
30ab11bae1 Use safer type operations with cli $options array 2023-01-18 19:06:32 +01:00
Alies Lapatsin
7e157cfe9d Allow to specify a custom shepherd endpoint (instead of domain) 2023-01-18 19:06:32 +01:00
Jack Worman
56f6dfecc8 Report unused baseline entries 2023-01-17 22:02:21 -05:00
Jack Worman
f9aa2d5ad3 Support constants in traits 2023-01-17 16:37:44 -05:00
Ezequiel
602d3ed53e Add missing int-range aliases into the list of psalm reserved words 2023-01-13 11:15:01 -03:00
Alies Lapatsin
f471ba9f36
Merge branch 'master' into auto-load-random-ext-stub-on-php82 2023-01-12 18:54:08 +01:00
Alies Lapatsin
fc72214bfc Automatically load stubs for random ext on PHP 8.2 2023-01-12 12:52:45 +01:00
Emmanuel Guiton
a7c60072dd
Merge branch 'vimeo:master' into master 2023-01-11 13:17:45 +01:00
Emmanuel GUITON
7b212954a9 Additional test and fix when comparing nested templates (vimeo#9094). 2023-01-11 13:17:06 +01:00
Alies Lapatsin
3b5d1a4856 Fix coding-style issue 2023-01-10 23:01:40 +01:00
Alies Lapatsin
a051090658 Merge remote-tracking branch 'origin/cleaunup-unsupported-extentions-message' into cleaunup-unsupported-extentions-message 2023-01-10 19:29:39 +01:00
Alies Lapatsin
69b6409feb Fix coding-style issues 2023-01-10 19:24:33 +01:00
Alies Lapatsin
e21e38d5ac
Merge branch 'master' into cleaunup-unsupported-extentions-message 2023-01-10 18:59:58 +01:00