Damian Wójcik
793b8d34d8
Add baseline ignoring carriage return test.
2023-03-28 14:40:11 +02:00
Corey Taylor
528bbe3757
Skip gnupg extension in callmap tests
2023-03-28 04:20:39 -05: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
andrew
72e5709ef2
Handle partially templated first-class-callables
2023-03-27 18:29:22 +03: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
Damian Wójcik
350687dcb7
Handle different line endings from baseline.
2023-03-24 10:48:03 +01:00
orklah
ef9a06c467
Merge pull request #9526 from othercorey/cleanup-unreflectable
...
Clean up unreflectable callmap methods
2023-03-24 07:13:19 +01:00
orklah
dfd7ffc459
always combine the result of expansions
2023-03-23 20:51:34 +01:00
Yannick Gottschalk
85a1c83591
Added to documentation and tests that api
can be used instead of psalm-api
2023-03-20 13:34:44 +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
963dd5d43d
Additional test
...
This was actually fixed previously
2023-03-18 03:45:09 -04:00
Bruce Weirdan
5a14f84fc7
Clarify testsss
2023-03-18 02:17:36 -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
c60b3ae3de
add more tests for #9506
2023-03-17 15:56:33 +01:00
Paweł Tomulik
3b4eb518a9
add tests for #9506
2023-03-17 15:56:30 +01:00
fluffycondor
f3e950bac7
str_* functions assert for non-empty-string
2023-03-17 17:58:44 +06:00
fluffycondor
723e40840e
Add InvalidLiteralArgument tests
2023-03-17 16:41:36 +06:00
fluffycondor
c2dae0e43f
Add php8 str_* functions signatures
2023-03-17 16:39:04 +06:00
orklah
531eec6df8
Merge pull request #9497 from ptomulik/issue-9496
...
Fixed #9496
2023-03-16 19:25:17 +01:00
orklah
c4f6b0cd15
Merge pull request #9528 from paoloconi96/master
...
Fix MissingThrowsDocblock when documented interface is extended by thrown exception interface
2023-03-16 19:01:42 +01:00
Paolo Conizzoli
3ccb1eaffe
Fix MissingThrowsDocblock when documented interface is extended by thrown exception interface
2023-03-16 12:01:16 +01:00
Corey Taylor
6dfaafde78
Clean up unreflectable callmap methods
2023-03-16 03:34:45 -05:00
fluffycondor
cfe8651bdd
Add tests for falsable return
2023-03-16 12:42:36 +06:00
fluffycondor
0c3fa5b5d0
Add depth range
...
According to
https://www.php.net/manual/en/function.json-decode.php#:~:text=The%20value%20must%20be%20greater%20than%200%2C%20and%20less%20than%20or%20equal%20to%202147483647
2023-03-16 12:08:48 +06:00
fluffycondor
d11c7cdb8e
Add JSON_THROW_ON_ERROR full support
2023-03-16 12:08:07 +06: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
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
24ddf9e739
revised tests for #9496
2023-03-13 06:07:19 +01:00
Paweł Tomulik
f61ffe4e27
Merge branch 'pvandommelen-issue-9496' into issue-9494-merged
2023-03-13 05:56:37 +01:00
Paweł Tomulik
1dfeaf8c06
add test for #9496
2023-03-13 05:43:18 +01: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
103aa019da
Fix integer overflow in array keys
...
Fixes vimeo/psalm#9498
2023-03-12 16:20:13 -04:00
orklah
47c482188d
Merge pull request #9474 from othercorey/missing-callmap-types
...
Add missing array, float, int and bool types to callmaps
2023-03-12 18:58:42 +01:00
Paweł Tomulik
b12ed07793
add test for #9496
2023-03-12 18:34:41 +01:00
Paweł Tomulik
388efaf85c
append commas to array items
2023-03-12 18:23:10 +01:00
Paweł Tomulik
fc402b1c95
add tests for #9433
2023-03-12 18:23:07 +01: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
d6daaa842e
Merge pull request #9479 from fluffycondor/json_throw_with_unescaped_unicode
2023-03-11 22:04:09 -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
fluffycondor
7ba0f9798c
Fix test
2023-03-10 11:44:53 +06:00
fluffycondor
2abefb9618
Return a non-empty-string with JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE
2023-03-10 11:34:23 +06:00
Corey Taylor
e71e2edd3c
Add missing array, float, int and bool types to callmaps
2023-03-09 13:04:03 -06:00
Corey Taylor
ee77ca63e8
Fix remaining intl callmaps
2023-03-08 20:59:14 -06:00
Bruce Weirdan
193a0dbe0e
Don't crash on unary minus overflow
...
Fixes vimeo/psalm#9464
2023-03-07 12:29:40 -04:00
Corey Taylor
8bd2267060
Fix DOM callmaps
2023-03-06 04:33:59 -06: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
Bruce Weirdan
9abd4285df
Use 8.2 in tests for 8.2 attributes
2023-03-03 04:39:04 -04:00
Bruce Weirdan
468dd1be4c
PHP 8.2 attributes moved to 8.2 stub
2023-03-03 04:28:37 -04:00
Bruce Weirdan
36913b13d5
Support for readonly
classes
2023-03-03 04:04:12 -04:00
Bruce Weirdan
7b8a0a61b9
Require <?php
tag in tests
...
This had me puzzled for some time on several occasions
2023-03-03 02:50:11 -04: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
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
5eed370fa5
fix outstanding CI issues
2023-03-02 18:02:23 +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
feb0cb8598
Merge branch 'master' into disableExtensions-hides-warnings
...
# Conflicts:
# src/Psalm/Config.php
2023-02-28 22:51:43 +01:00
Paweł Tomulik
68fc72e139
add unit test for #4460
2023-02-28 11:38:44 +01:00
orklah
e212b06970
Merge pull request #9420 from othercorey/iterator-spl-callmap
...
Fix remaining spl and iterator callmaps
2023-02-27 22:32:32 +01:00
Corey Taylor
879d9cd788
Fix remaining spl and iterator callmaps
2023-02-27 15:23:48 -06: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
a9b9d386a9
added testcases with undefined constant concatination
2023-02-27 22:00:36 +07:00
Paweł Tomulik
ee032d4ca9
add unit tests for #9401
2023-02-27 00:07:00 +01:00
Evan Shaw
f7eaa5daec
Preserve PossiblyUndefinedVariable when fixing UnusedVariable
2023-02-25 20:08:01 +13: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
Corey Taylor
74a67a0416
Update Phar callmaps
2023-02-23 21:02:24 -06: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
f4e66a0fbf
Add test
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
1769f8b9a4
Refine arrays in foreach
loops to non-empty-array
...
Fixes vimeo/psalm#9378
2023-02-22 20:44:50 -04:00
Javier Sanahuja
4f83324a91
Support sizeof alias of count
2023-02-22 23:11:10 +01:00
Ulrich Eckhardt
4596301290
FFI Stubs: Define a set of tests.
...
Mostly, those are derived from examples from the documentation.
2023-02-21 23:08:58 +01:00
Bruce Weirdan
c46eccda76
Merge pull request #9358 from weirdan/revert-8761
2023-02-21 02:57:53 -04:00
Corey Taylor
c62465ceef
Fix several spl callmap methods
2023-02-20 22:30:21 -06:00
Bruce Weirdan
01c19d94ba
Added a bunch of tests from referenced issues
2023-02-20 23:45:01 -04: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
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
38cc316ce9
Update tests/TypeReconciliation/ConditionalTest.php
2023-02-19 06:02:12 -04:00
Evan Shaw
a25fe35584
Negated is_numeric narrows scalar type
2023-02-19 22:38:34 +13:00
Bruce Weirdan
863f15ab15
Merge pull request #9337 from weirdan/validate-test-environment
2023-02-19 04:35:11 -04: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
Bruce Weirdan
236c1a8ae5
Added the test to validate test environment itself
...
We should make sure that the environment the tests are run is as strict
as possible. For example, zend.assertions should be enabled.
2023-02-19 03:52:12 -04:00
Evan Shaw
d4a57c863c
Enable store_node_types for all test cases
2023-02-19 19:52:45 +13:00
Evan Shaw
c8393bd50d
Fix language server first-class callable crashes
2023-02-19 14:18:17 +13:00
Bruce Weirdan
4f22c2e7c6
Propagate phantom classes to closure context
...
Fixes vimeo/psalm#9317
2023-02-18 01:52:10 -04:00
Corey Taylor
e813a54d03
Skip verifying memcache extension callmap
2023-02-17 01:27:37 -06: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
f70f6517a7
Merge pull request #9314 from weirdan/flag-unused-docblock-params
...
Flag docblock parameters that have no counterparts in function signature
2023-02-15 22:31:41 -04:00
Bruce Weirdan
1e71da3799
Merge pull request #9309 from othercorey/fix-memcached-callmap
2023-02-15 22:24:39 -04:00
Bruce Weirdan
0e9f04c55d
Merge pull request #9313 from othercorey/allow-ignored-callmap
2023-02-15 22:23:02 -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
Corey Taylor
0598402620
Skip verifying callmaps based on name pattern
2023-02-15 20:00:04 -06:00
Bruce Weirdan
ee823619b8
Flag direct constructor calls
...
Fixes vimeo/psalm#2975
2023-02-15 20:14:00 -04:00
Corey Taylor
ab77cfd490
Fix memcached extension callmap
2023-02-15 17:26:58 -06:00
Alies Lapatsin
4da3252886
Merge branch 'master' into disableExtensions-hides-warnings
2023-02-15 22:01:38 +01:00
Bruce Weirdan
d6b75057a4
Fix test
2023-02-15 03:02:34 -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
a538439a87
Add option to skip callmap test
...
With this change, callmap tests can be skipped with
`--exclude-group=callmap`:
```console
$ php-noxdebug vendor/bin/paratest --passthru-php="-dmemory_limit=-1" --exclude-group=callmap
```
2023-02-15 00:30:45 -04:00
Bruce Weirdan
840250c534
Update expectations formatting
...
It's easier to read with consistent indentation
2023-02-14 21:59:01 -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
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
orklah
9921625691
Merge pull request #9278 from othercorey/fix-func-callmap
...
Fix remaining callmap functions
2023-02-13 07:10:43 +01:00
Corey Taylor
8fb290eb0d
Fix remaining callmap functions
2023-02-12 23:10:09 -06:00
Bruce Weirdan
873d79c5d7
Forbid overriding built-in enum methods
...
Fixes vimeo/psalm#9274
2023-02-13 00:37:59 -04:00
orklah
5d1fe88d3f
Merge pull request #9272 from weirdan/forbid-extending-some-interfaces
...
Forbid implementing some interfaces
2023-02-12 08:38:54 +01:00
Corey Taylor
42e301cf84
Update callmap types for php 8.2
2023-02-12 01:24:43 -06: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
Corey Taylor
9547a5cba5
Fix several callmap function signatures
2023-02-11 04:53:11 -06: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
Bruce Weirdan
1ee0f1bcb8
Merge pull request #9256 from othercorey/spoofchecker-callmap
...
fixes https://github.com/vimeo/psalm/issues/9254
2023-02-09 12:53:42 -04:00
Corey Taylor
b467a0a74e
Fix Spoofchecker callmaps
2023-02-09 10:38:39 -06: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
Bruce Weirdan
3c4a829f71
Fixed more CS issues
2023-02-07 11:20:02 -04:00
Corey Taylor
e8ae1ec084
Convert callmaps resource types
2023-02-06 01:12:14 -06: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
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
Corey Taylor
f922e576c8
Fix xmlrpc callmap functions that were dropped in PHP 8.0
2023-02-02 12:21:31 -06:00
Bruce Weirdan
5d930a438a
Fix invalid test cases
2023-02-02 12:27:57 -04:00
Bruce Weirdan
fb65c79079
Fix newly discovered CS issues
2023-02-02 12:19:22 -04: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
c55d297d0a
Fix coding style issue
2023-01-29 18:52:09 +01:00
Alies Lapatsin
c75e4bdb28
Merge remote-tracking branch 'origin/unify-deprecation-messages' into unify-deprecation-messages
2023-01-29 18:32:55 +01:00
Alies Lapatsin
7526d60f2a
Update assertion to reflect a new output
...
It reverts 588d9e08bc (diff-1ef46093f20172c4dc1cbe5a54e5b60c255082acd3f7c382dae621d8d23df404R172)
2023-01-29 18:32:31 +01: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
247d30f74c
Detect duplicate keys in array shapes
2023-01-25 10:42:05 +01: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
Bruce Weirdan
70f2fb7d1b
Check $this
in static closures
...
Fixes vimeo/psalm#9148
Fixes vimeo/psalm#2813
2023-01-23 05:16:12 -04:00
Bruce Weirdan
2af7f51394
Suppress warnings when --no-output
is specified
2023-01-22 20:40:21 -04: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
orklah
9e34de59cb
Merge pull request #9156 from vimeo/indent-docblocks-in-tests
...
Indent docblocks in DocComment test
2023-01-21 00:09:43 +01:00
Bruce Weirdan
bf99b76798
Indent docblocks in DocComment test
...
Since heredocs in PHP 7.3+ automatically strip leading whitespace we can
fix the formatting for this test.
2023-01-20 18:15:07 -04:00
Jack Worman
787b9ae687
Fix dom_import_simplexml()
2023-01-18 18:31:54 -05:00
orklah
dfbd0458f4
Merge pull request #9130 from jack-worman/Report_unmatched_baseline_rules
...
Report unused baseline entries
2023-01-18 18:59:37 +01:00
orklah
466ff68dae
Merge pull request #9122 from othercorey/fix-returns
...
Fix remaining ignored CallMap return types that can be updated
2023-01-18 18:57:05 +01:00
Jack Worman
56f6dfecc8
Report unused baseline entries
2023-01-17 22:02:21 -05:00
Corey Taylor
cfaf763ba7
Fix remaining ignored CallMap return types that can be updated
2023-01-17 17:24:51 -06:00
Jack Worman
f9aa2d5ad3
Support constants in traits
2023-01-17 16:37:44 -05:00
Corey Taylor
66ee278de8
Update conditional test to use filter_input with mixed return
2023-01-15 07:43:26 -06:00
Corey Taylor
bbc522709b
Clean up more callmap return types
2023-01-15 03:57:22 -06:00
Ezequiel
423b1acbd6
Add tests for the remaining int-range
aliases
2023-01-13 11:15:24 -03: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
Vincent QUATREVIEUX
e5f297ddbb
fix: Handle template type on promoted property #8951
2023-01-10 10:41:48 +01:00
Ryan Bonham
bf62ef8b72
Add assertions to check return types for get_headers
2023-01-09 08:39:19 -05:00
Ryan Bonham
0ba821116e
Fix bad conflict resolution during merge from master.
2023-01-07 19:32:04 -05:00
therealryanbonham
e4e52da218
Merge branch 'master' into 9066_fix_get_headers_signature
2023-01-07 19:27:01 -05:00
Ryan Bonham
ec2f93f33e
Add Test for get_headers associative param in php 7 and php8.
2023-01-07 19:25:04 -05:00
orklah
729c0ba5ed
Merge pull request #9061 from lptn/cleaner_assertions
...
Make it more clear what do we test from Psalm output
2023-01-07 23:16:08 +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
Ryan Bonham
e7b5c99255
Remove 'get_headers' from InternalCallMapHandlerTest::$ignoredFunctions
2023-01-06 20:12:02 -05:00
Bruce Weirdan
afb8c8891b
fix I::cases()
where interface I extends BackedEnum
...
Fixes vimeo/psalm#9065
Inheritance in stubs seems to be broken
2023-01-05 21:35:47 -04:00
Alies Lapatsin
5ffb4f2938
Make it more clear what do we test from Psalm output
2023-01-05 18:12:29 +04:00
kkmuffme
d4301455a6
fix test should not change phpdoc to native type hint but keep phpdoc
2023-01-05 09:44:23 +01:00
kkmuffme
25cadb6776
add null to tests to fix invalid return type
2023-01-05 09:44:23 +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
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
e81823e193
Merge pull request #9035 from othercorey/iterator-returns
...
Fix iterator and exception callmaps
2023-01-01 11:22:39 +01:00
Corey Taylor
e779c5f741
Fix iterator and exception callmaps
2022-12-31 11:34:48 -06:00
kkmuffme
82f71a7ccb
add test
2022-12-31 00:18:08 +01:00
orklah
6353143eaf
Merge pull request #9021 from orklah/nonempty-reconcile
...
Non empty reconciliation
2022-12-29 22:35:12 +01:00
orklah
5bfb87c624
Merge pull request #9022 from Ocramius/fix/#8983-allow-large-union-types-in-array-type-inference
...
Better type inference and type checking for large union types used in array keys/values
2022-12-29 10:48:05 +01:00
orklah
790c30959d
Merge pull request #9016 from Ocramius/feature/#5039-more-refined-types-for-explode-core-function
...
Refined `explode()` types
2022-12-29 10:23:18 +01:00
Marco Pivetta
e6600fea21
Better type inference and type checking for large union types used in array keys/values
...
Fixes #8983
This patch adds a basic test showing that, when reaching a union type with 30 elements
or more, Psalm used to fail with an error, because the large union type got simplified
into a more general type as part of performance optimizations done in `TypeCombiner::combine()`.
This means that a type like `array<1|2|3|(etcetera...)|100, mixed>` was internally
simplified to `array<int, mixed>`, after reaching 30 elements or more, which in turn
led to problems and confusing errors when large union types are in play.
Such union types are relatively common in lookup-table-alike value objects.
By removing the hardcoded call-time limit of `30` types to be combined, we hereby
rely on the default `TypeCombiner::combine()` limit of `500` items, which is more
healthy.
This may come with some performance implications, but it is worth trying out, for
now.
Further parameters passed to `TypeCombiner::combine()` that were already matching
parameter default values were also omitted from the call-sites.
2022-12-29 10:05:23 +01:00
orklah
907729d83a
remove useless imports
2022-12-29 01:00:06 +01:00
orklah
ee98fac581
use Atomic to create the types
2022-12-29 00:51:09 +01:00
orklah
5a002c448b
fix non-empty reconciliation
2022-12-29 00:49:31 +01:00
orklah
9770e113c3
Merge pull request #9020 from orklah/isContainedbug
...
Is containedbug
2022-12-28 23:46:38 +01:00
orklah
a290729087
fix test
2022-12-28 23:33:28 +01:00
orklah
a8fd349e07
fix #7809
2022-12-28 23:29:33 +01:00
orklah
94f9d48bca
Merge pull request #9019 from mmcev106/prevent-erroneous-escapes
...
Prevent DB escaping functions from affecting non-sql taints
2022-12-28 21:32:12 +01:00
Mark McEver
53c3f1ebb3
Prevent other DB escaping functions from escaping non-sql taints
2022-12-28 14:19:01 -06:00
orklah
435acb823c
Merge pull request #9018 from orklah/TClosure
...
create proper TClosure instead of TNamedObject with a Closure value
2022-12-28 20:53:52 +01:00
orklah
fa4891ce58
create proper TClosure instead of TNamedObject with a Closure value
2022-12-28 20:42:59 +01:00
Mark McEver
69f31dcd4a
Prevent mysqli escaping functions from escaping non-sql taints
2022-12-28 13:39:01 -06:00
orklah
58853c00f8
add test
2022-12-28 19:13:03 +01:00
Marco Pivetta
45f743f851
Adjusted assertDifferentTypeOfArray
test to avoid intersecting incompatible string arrays
...
Getting one interesting failure caused by the `lowercase-string` refinement done before:
```
There was 1 error:
1) Psalm\Tests\AssertAnnotationTest::testValidCode with data set "assertDifferentTypeOfArray" ('<?php\n /*...ts[1];')
Psalm\Exception\CodeException: DocblockTypeContradiction - src/somefile.php:21:21 - Cannot resolve types for $parts - docblock-defined type list{0: lowercase-string, 1?: lowercase-string} does not contain list{string, string}
```
Happens on this bit:
```php
'assertDifferentTypeOfArray' => [
'code' => '<?php
/**
* @psalm-assert list{string, string} $value
* @param mixed $value
*/
function isStringTuple($value): void {
if (!is_array($value)
|| !isset($value[0])
|| !isset($value[1])
|| !is_string($value[0])
|| !is_string($value[1])
) {
throw new \Exception("bad");
}
}
$s = "";
$parts = explode(":", $s, 2);
isStringTuple($parts);
echo $parts[0];
echo $parts[1];',
],
```
If I change this to:
```
@psalm-assert list{lowercase-string, lowercase-string} $value
```
Then everything works: I'm wondering if this error has to do with array intersections, and whether suppressing it suffices.
For now, changing the input string, so it is not a `lowercase-string`, is sufficient.
2022-12-28 17:57:33 +01:00
Marco Pivetta
c0c0116809
Using list{0: string, 1?: string}
syntax for more precise array key types
...
Thanks to @orklah's feedback, the `explode()` return type is now much more precise too.
Ref: https://github.com/vimeo/psalm/pull/9016#discussion_r1058458616
2022-12-28 17:48:33 +01:00
Marco Pivetta
6341d7fef0
Adjusted existing tests to the new signature of explode()
...
Note how the signature became `array{0: string, 1?: string, 2?: string, array<int, string>}`,
which may be a side-effect of unions between a defined hashmap structure with array
keys, and `list<string>`.
2022-12-28 17:39:06 +01:00
orklah
dbcfe62c52
Merge pull request #8987 from jack-worman/Always_check_unused_methods_and_properties
...
Add @psalm-api annotation
2022-12-28 15:20:48 +01:00
orklah
d338b00cb7
Merge pull request #8999 from VincentLanglet/union
...
Preserve from_docblock in TypeCombiner
2022-12-28 10:08:12 +01:00
orklah
41ae518800
Merge pull request #9001 from fluffycondor/http_response_header-non-empty-list
...
Make `$http_response_header` a non-empty-list
2022-12-28 00:27:30 +01:00
Bruce Weirdan
52da29e389
Do not require return type on destructors in interfaces
...
Fixes vimeo/psalm#9008
2022-12-26 15:45:44 -04:00
Vincent Langlet
b1f1ca6d7e
Try
2022-12-25 19:11:54 +01:00
Vincent Langlet
a8ef02db5a
Real fix
2022-12-25 17:35:47 +01:00
fluffycondor
bfc00056e3
Add test
2022-12-25 11:50:09 +06:00
fluffycondor
032f01114e
Fix test
2022-12-25 11:41:34 +06:00
Jack Worman
1bb9eb4cfc
forbidden function bug and better get_defined_functions() signature
2022-12-24 12:34:40 -06:00
fluffycondor
69da58d578
Make http_response_header a non-empty-list of non-falsy-string
2022-12-25 00:02:58 +06:00
Vincent Langlet
ebd5727dec
Update type
2022-12-24 13:38:02 +01:00
Vincent Langlet
723001d814
Failing test
2022-12-24 13:17:08 +01:00
Jack Worman
703a1e1698
@psalm-api
2022-12-23 16:13:46 -06:00
orklah
597957989c
Merge pull request #8990 from othercorey/verify-param-nullable
...
Verify nullable callmap parameters
2022-12-23 18:30:27 +01:00
Corey Taylor
d6eca8c056
Verify nullable callmap parameters
2022-12-23 06:04:35 -06:00
Emmanuel GUITON
164e279d08
Fixed object comparison that aims to improve nested template analysis (vimeo#8112).
2022-12-22 15:16:17 +01:00
Emmanuel Guiton
b138107bf3
Merge branch 'vimeo:master' into master
2022-12-22 15:15:46 +01:00
Jack Worman
8e5904d624
Fix get_object_vars on enums
2022-12-21 22:51:53 -06:00
orklah
898aa90436
Merge pull request #8967 from jack-worman/Remove_occurrences
...
Remove occurrences from error baseline
2022-12-21 20:31:56 +01:00
e2a5ef1eb5
Revert
2022-12-21 14:05:05 +01:00
Jack Worman
896799dff4
Remove occurrences
2022-12-21 06:45:45 -06:00
Emmanuel GUITON
3364bd97e1
Additional code style fixes (vimeo#8112).
2022-12-21 11:51:42 +01:00
Emmanuel Guiton
94adf78c16
Merge branch 'vimeo:master' into master
2022-12-21 10:56:47 +01:00
Andrew Nagy
24017059ee
fix phpcs issues
2022-12-20 23:31:56 +00:00
Jack Worman
b2ccf2487e
Add Codebase to remaining events
2022-12-20 17:18:50 -06:00
Andrew Nagy
5f9487e9a9
async test case fixes
2022-12-20 21:26:25 +00:00
Andrew Nagy
30f8331da6
additional fixes
2022-12-20 21:25:04 +00:00
Andrew Nagy
f1b0c4fa6d
additional fixes
2022-12-20 21:16:29 +00:00
Andrew Nagy
b9791d24dc
fix some tests
2022-12-20 21:09:34 +00:00
Andrew Nagy
82d8974fe3
merge to v5
2022-12-20 20:52:25 +00:00
orklah
91081f77fd
Merge pull request #8781 from weirdan/8758-optional-offsets-in-phpstorm-meta
...
Allow omitting argument offsets for map-type overrides in phpstorm.meta
2022-12-20 19:38:51 +01:00
3549162acc
Update
2022-12-20 13:44:05 +01:00
02cd829b7d
Fix bug
2022-12-20 13:28:47 +01:00
825f46f9dc
Fix test
2022-12-19 22:23:31 +01:00
dc5a4576a5
Fix
2022-12-19 21:25:06 +01:00
194f71052c
Add failing test
2022-12-19 21:11:10 +01:00
4fb5a615f1
Fix tests
2022-12-19 19:24:03 +01:00
ab2692fdd3
Update
2022-12-19 18:31:43 +01:00
ec11254316
Update
2022-12-19 14:27:41 +01:00
e923229204
Fix array_merge
2022-12-19 14:01:00 +01:00
326ba91812
Update
2022-12-19 13:49:42 +01:00
8088f046cd
Fix
2022-12-19 13:10:17 +01:00