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

9324 Commits

Author SHA1 Message Date
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
Vincent QUATREVIEUX
e5f297ddbb fix: Handle template type on promoted property #8951 2023-01-10 10:41:48 +01:00
orklah
9366c5ed32
Merge pull request #9012 from kkmuffme/ignore-missingfile-error-for-file_exists-files
dont report MissingFile error when file_exists is validated beforehand
2023-01-09 23:33:04 +01:00
Alies Lapatsin
2626827876
Merge branch 'master' into cleaunup-unsupported-extentions-message 2023-01-09 17:39:56 +04:00
Alies Lapatsin
8b23919241 Extend a list of php ext, supported by CallMap files 2023-01-09 14:31:17 +01:00
orklah
4ec4ed75a6
Merge pull request #9026 from kkmuffme/fix-never-void-combined-null-return-type-false-positives
fix implicit return type
2023-01-07 22:32:08 +01:00
Alies Lapatsin
f197d137d6 Internal: use more specific types 2023-01-06 00:27:01 +04:00
Alies Lapatsin
ce8dcdfee7 Do not list core and bundled extensions as unsupported 2023-01-05 18:42:38 +04:00
kkmuffme
2bfdf9bc68 code style 2023-01-05 09:44:23 +01:00
kkmuffme
ea1ece5cd0 fix "No return statements were found" not reporting 2023-01-05 09:44:23 +01:00
kkmuffme
b85d6374fe Revert "Fix psalter bug changing to native types even when backwards incompatible is false"
This reverts commit 98e22c27fff7be6a143406abe8b2cdd54d02283b.
2023-01-05 09:44:23 +01:00
kkmuffme
a0aff18bd8 Fix psalter bug changing to native types even when backwards incompatible is false 2023-01-05 09:43:19 +01:00
kkmuffme
6b9816071c suppress psalm bug 2023-01-05 09:43:19 +01:00
kkmuffme
4c0cae7cd0 code style 2023-01-05 09:43:19 +01:00
kkmuffme
13f6258a06 class overrides stubbed should be ignored too 2023-01-05 09:43:19 +01:00
kkmuffme
67e6cb8142 fix void => null wrong condition
* fix void => null to greedy suppressing errors in never cases
* fix test allowNoReturnInSubclassWithNullableReturnType to not fail
2023-01-05 09:43:19 +01:00
kkmuffme
1341c15edc fix TypeCombiner void => null from docblock missing property
* fix InvalidReturnType "Not all code paths of" when function returns null combined types (void, never) https://psalm.dev/r/db4e313898
* fix false positive InvalidReturnType for void|never phpdoc when function returns void and exits
2023-01-05 09:43:19 +01:00
kkmuffme
4dd92fb795 fix implicit return type
* fix implicit void return type errors https://psalm.dev/r/b0e397c14e
* fix void + never = null return type error https://psalm.dev/r/6f227ae9b9
* fixes https://github.com/vimeo/psalm/issues/8912 and https://github.com/vimeo/psalm/issues/8862
2023-01-05 09:43:19 +01:00
kkmuffme
166df8a99f dont report MissingFile error when file_exists is validated beforehand
Fix https://github.com/vimeo/psalm/issues/3886
2023-01-05 09:32:36 +01:00
orklah
7d6a48ab14
Merge pull request #9044 from kkmuffme/absolute-autoloader-path-not-working
fix autoloader not working with absolute path
2023-01-04 22:11:38 +01:00
kkmuffme
1a0c0fe5c5 relative path as absolute paths autoloader legacy issue 2023-01-03 15:35:57 +01:00
kkmuffme
76f90e62f2 code style 2023-01-03 15:21:15 +01:00
kkmuffme
8fe00cf609 fix autoloader not working with absolute path 2023-01-03 15:13:38 +01:00
Philip Hofstetter
bab17568dc
fix DateTime::modify() and DateTimeImmutable::modify() return types
even though the two methods return types are documented as returning
their respective types, in PHP they are in-fact returning `static`
internally in all versions of PHP currently supported by psalm.

This fixes #9042
2023-01-03 12:11:38 +01:00
orklah
ef1264bd46
Merge pull request #9030 from kkmuffme/psalm-scope-this-doesnt-work-with-FQCN-leading-backslash
fix @psalm-scope-this not working with FQCN with leading backslash
2022-12-31 12:08:20 +01:00
orklah
406946d4c4
Merge pull request #9031 from danog/misc_fixes
Misc fixes
2022-12-30 21:28:11 +01:00
4b00095b31 cs-fix 2022-12-30 21:06:03 +01:00
0b67844420 Improve variable naming and improve docs 2022-12-30 21:00:38 +01:00