1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00
Commit Graph

4515 Commits

Author SHA1 Message Date
Bruce Weirdan
81ca05f3ab
Merge pull request #6790 from orklah/fix_yield 2021-11-01 20:25:54 +02:00
orklah
c5c779c4a9 detect yield in new 2021-11-01 19:04:49 +01:00
orklah
af129f8851 detect yield in new 2021-11-01 19:04:37 +01:00
Bruce Weirdan
ac098a52da
Allow to forbid exit() and die() 2021-10-31 03:02:16 +03:00
Bruce Weirdan
f660ff4f83
Move ForbiddenCode-related tests to the corresponding test file 2021-10-31 02:43:17 +03:00
Alexey Borzov
136624e817 Add another check to a PHP_VERSION_ID condition test 2021-10-30 01:13:28 +03:00
Alexey Borzov
91ec5712ad Add a means to switch return types based on PHP_VERSION_ID
As suggested in vimeo/psalm#6755
2021-10-29 22:19:38 +03:00
orklah
61a7cbe9c5
Merge pull request #6764 from orklah/promoted-property-docblock
allow documenting promoted properties with @var
2021-10-28 22:19:42 +02:00
orklah
b53138ebde fix CS 2021-10-28 22:10:22 +02:00
orklah
067f8375cf replace exception by InvalidDocblock 2021-10-28 22:05:43 +02:00
orklah
d19018b3fa
Merge pull request #6775 from orklah/is_a
fix is_a when used with Stringable classes
2021-10-28 21:47:27 +02:00
orklah
9823e87b80
Merge pull request #6774 from orklah/reconcileFalsyOrEmpty
fix local variable defined too early
2021-10-28 21:47:17 +02:00
orklah
ce87fc4882 fix is_a when used with Stringable classes 2021-10-28 20:08:43 +02:00
orklah
b9effdb28a
Merge pull request #6742 from zoonru/fix_fewer_template_parameters
Fix template parameter collection for child classes with fewer parameters (fixes #6734)
2021-10-28 20:06:11 +02:00
orklah
a7c44a1a19 fix local variable defined too early 2021-10-28 19:33:27 +02:00
5fae548e62
Add template support to @psalm-self-out 2021-10-28 10:44:37 +02:00
orklah
e17ca1ba10 fix CS/test 2021-10-27 22:45:16 +02:00
orklah
9b7eabe17f allow documenting promoted properties with @var 2021-10-27 22:35:21 +02:00
02e293bc07
Improve test 2021-10-27 11:02:35 +02:00
9c59550e15
Fully fix recursive template parameter resolution 2021-10-27 10:58:33 +02:00
orklah
dc2ac427ca Don't remove a type because they have a common parent 2021-10-26 22:54:55 +02:00
3f1fef1fce
Fix tests 2021-10-26 13:38:06 +02:00
6fe44b3374
Add tests 2021-10-26 13:26:36 +02:00
Bruce Weirdan
4b0c8806a7
Merge pull request #6739 from orklah/instanceof_notliteral 2021-10-25 23:45:17 +03:00
orklah
8e0cf0e74b add test 2021-10-25 20:16:58 +02:00
orklah
9fb959150a
Merge pull request #6730 from orklah/int-template-arithmetics
don't emit issues when doing arithmetics on int templates
2021-10-24 20:39:54 +02:00
orklah
af918a95a2 don't emit issues when doing arithmetics on int templates 2021-10-24 19:30:39 +02:00
orklah
90d6239d74 strlen of strtolower of string is not always true 2021-10-24 18:40:13 +02:00
orklah
e33492398b
Merge pull request #6726 from orklah/crash_intrange
Don't crash on falsy with int ranges
2021-10-24 14:29:22 +02:00
orklah
c38139a87c Don't crash on falsy with int ranges 2021-10-24 13:59:21 +02:00
orklah
68528985d6
Merge pull request #6724 from orklah/impure_callstatic
flag impure calls made through __callstatic
2021-10-24 10:30:56 +02:00
orklah
a0681a4498 flag impure calls made through __callstatic 2021-10-24 09:55:40 +02:00
orklah
0339815070 fix type leaking when using ternaries 2021-10-23 18:58:05 +02:00
orklah
b63d877f48
Merge pull request #6720 from orklah/loop-template-regression
Don't refine empty/falsy assertions on templates inside loops
2021-10-23 14:31:10 +02:00
orklah
78a4c78187
Merge pull request #6718 from orklah/5651
fix literal string access on a non empty array
2021-10-23 12:11:39 +02:00
orklah
fb5a652e18 Don't refine empty/falsy assertions on templates inside loops 2021-10-23 11:17:47 +02:00
orklah
2cc5c555c2 fix literal string access on a non empty array 2021-10-22 18:17:08 +02:00
orklah
2d90631c87
Merge pull request #6689 from orklah/traversable&array
only fuse array & Traversable with phpstorm generics
2021-10-21 22:38:59 +02:00
orklah
1c0b802abb fix regression 2021-10-21 21:10:12 +02:00
orklah
f0f0b4a8a8
Merge pull request #6708 from orklah/skipped
skipped tests
2021-10-21 13:17:03 +02:00
orklah
8b98e645eb skipped tests 2021-10-20 23:37:52 +02:00
orklah
31bbd5a967
Merge pull request #6707 from orklah/!falsy_on_empty-string
improve falsy on non-empty-string
2021-10-20 23:18:12 +02:00
orklah
7ce0c3a6e3 improve falsy on non-empty-string 2021-10-20 22:31:03 +02:00
orklah
1f02795e42 fix missing implicit __toString 2021-10-20 19:54:32 +02:00
orklah
4755131585 more consistency 2021-10-20 07:32:04 +02:00
orklah
5d154e1bda fix test 2021-10-18 22:00:51 +02:00
orklah
a9e2284e79 add test 2021-10-18 21:51:36 +02:00
orklah
f7a63361ad
Merge pull request #6679 from SCIF/bugfix-5694-arrayfilter
Improve handling of positive ints by array_filter()
2021-10-17 23:20:26 +02:00
Aleksandr Zhuravlev
b664850cdc Added support of asserting properties of objects out of scope 2021-10-17 21:29:25 +13:00
Aleksandr Zhuravlev
978d9ec774 Improve handling of positive ints by array_filter() 2021-10-16 20:47:22 +13:00
orklah
56c73142d6 don't emit InvalidReturnType when return type was inferred to never 2021-10-16 00:15:17 +02:00
orklah
1aad830392
Merge pull request #6654 from zoonru/fixes
Fix manipulation of intersection types, arrow functions, foreign static types, parameter static types, T|false|null unions.
2021-10-15 23:41:24 +02:00
ElisDN
7b47063585 Add array typed tests 2021-10-15 14:30:20 +03:00
ElisDN
f26e9ae3b1 Add array replace tests 2021-10-15 14:30:20 +03:00
orklah
b8a2ba251f
Merge pull request #6672 from orklah/phpstorm-generics
prevent phpstorm generics from touching to signature types
2021-10-14 21:25:36 +02:00
orklah
a1b1080c4e prevent phpstorm generics from touching to signature types 2021-10-14 21:04:53 +02:00
orklah
110f2b4822
Merge pull request #6658 from fluffycondor/method-annotation-parsing-fix
Fix @psalm-method annotation parsing
2021-10-14 17:36:42 +02:00
Semyon
28385dc526 Fix failed test 2021-10-14 18:00:32 +03:00
Bruce Weirdan
6abdb092bc
Merge pull request #6667 from SCIF/bugfix-5135-reflectionnamedtype-stub 2021-10-14 13:26:50 +03:00
Aleksandr Zhuravlev
657f8e22ed Made the test marked 7.4 2021-10-14 22:05:40 +13:00
244a90ca4f
Fix #6665 2021-10-14 10:56:54 +02:00
orklah
75c3f8716a
Merge pull request #6652 from orklah/is_a_stub
stub for is_a
2021-10-14 00:13:13 +02:00
Aleksandr Zhuravlev
cbb67c0672 Stubbed RelfectionNamedType 2021-10-14 11:09:52 +13:00
orklah
e17290a9bc
Merge pull request #6613 from orklah/string-unpacking
String unpacking
2021-10-13 15:18:11 +02:00
24f1b60e53
Fix nullable unions 2021-10-13 14:05:48 +02:00
orklah
c96be1f68e fix tests 2021-10-13 11:47:57 +02:00
orklah
758acccb91 fix tests 2021-10-13 11:43:17 +02:00
ce60fa2151
Cleanup 2021-10-13 11:26:01 +02:00
orklah
c4eb548603 more precise type 2021-10-13 11:22:40 +02:00
orklah
83f2cf2eac switch the test from invalid to valid 2021-10-13 11:22:40 +02:00
orklah
690c24f824 array unpacking with strings 2021-10-13 11:22:40 +02:00
b6e7201b5a
Forbid static in parameter typehint 2021-10-13 11:22:33 +02:00
1c99af205b
Fix manipulation of intersection types, arrow functions, foreign static types, T|false|null unions. 2021-10-13 11:13:43 +02:00
orklah
e7cd2eac0a
Merge pull request #6641 from orklah/weird-assertion-count
Union::getAssertionString with multiple types
2021-10-13 08:15:28 +02:00
orklah
1efe272aed stub for is_a 2021-10-12 22:12:51 +02:00
orklah
04813bf556 fix test 2021-10-12 15:58:06 +02:00
orklah
233fe11d12 SimpleXMLElement is not always truthy 2021-10-12 15:46:02 +02:00
orklah
c6fb81007c
Merge pull request #6629 from orklah/loops-tweaking
tweaking with loops
2021-10-11 20:45:54 +02:00
orklah
af414ffe59
Merge pull request #6642 from orklah/inside-conditional
Inside conditional
2021-10-11 20:45:14 +02:00
orklah
b54dddf484
Merge pull request #6643 from orklah/never-closure
infer never on closures(and more?)
2021-10-11 20:42:02 +02:00
orklah
29966b38bd fix test 2021-10-11 19:23:56 +02:00
orklah
e4aaae29e9 fix test 2021-10-11 19:12:26 +02:00
orklah
f9377c53fc infer never on closures(and more?) 2021-10-11 18:52:26 +02:00
orklah
88dd4eace3 add test 2021-10-11 17:33:02 +02:00
orklah
55a696f83f fix test 2021-10-11 16:11:22 +02:00
orklah
4bcce010e4 loose comparison between int/float and string result in numeric-string 2021-10-11 16:11:05 +02:00
orklah
d08845900b
Merge pull request #6639 from orklah/refine-TKeyedArray-with-iterable
Refine TKeyedArray with iterable
2021-10-11 16:09:00 +02:00
orklah
2e64854a6c don't allow getAssertionString to return a part of the Union 2021-10-11 16:07:57 +02:00
orklah
5bb8eb6eb2 add test 2021-10-11 13:36:56 +02:00
orklah
3aee938910
Merge pull request #6636 from orklah/possibly-undefined-satisfy-nullable
Allow sending possibly_undefined inputs to optional params
2021-10-10 23:12:38 +02:00
orklah
fb8b07613d Allow sending possibly_undefined inputs to optional params 2021-10-10 12:44:04 +02:00
orklah
5134a92e2a
Merge pull request #6623 from orklah/templated-array-key
Templated array key
2021-10-10 10:43:12 +02:00
orklah
cdfc119e33 add test 2021-10-10 10:31:30 +02:00
orklah
e7a86148b0 Allow Psalm to store unresolved Unary Ops 2021-10-10 09:24:25 +02:00
orklah
8b151f39c8 put back one of the errors 2021-10-09 22:09:48 +02:00
orklah
d7dfd87390 remove suppress on an old test 2021-10-09 21:04:06 +02:00
orklah
4866155b3a add test 2021-10-09 20:03:52 +02:00
orklah
f62c76a334
Merge pull request #6622 from orklah/return_0
fix @return 0
2021-10-09 18:25:46 +02:00
orklah
4137cabaed add test 2021-10-09 17:59:41 +02:00
orklah
d40335ff37
Merge pull request #6612 from orklah/empty-array_is_list
array_is_list on empty array returns true
2021-10-08 17:16:35 +02:00
orklah
682784c886 array_is_list on empty array returns true 2021-10-08 17:05:35 +02:00
orklah
f35df421e2
Merge pull request #6604 from orklah/array-unshift-on-empty-array
Array unshift on empty array
2021-10-07 23:04:10 +02:00
orklah
22fb4b5d19 add test 2021-10-07 11:04:51 +02:00
orklah
ecb541ea51 add test 2021-10-05 19:49:05 +02:00
orklah
dbc70900ff fix tests 2021-10-05 13:41:40 +02:00
orklah
13c2ba61ea fix tests 2021-10-05 13:41:20 +02:00
orklah
902206b3ee
Merge pull request #6578 from orklah/psalter-psalm-param
Psalter psalm-param
2021-10-05 12:51:52 +02:00
orklah
d22105de72
Merge pull request #6580 from orklah/psalter-generic-object-tophpstring
fix wrong type description added in signature
2021-10-04 20:23:42 +02:00
orklah
2c728546e4
Merge pull request #6485 from orklah/list-assert
assert that some type is a list
2021-10-04 13:31:34 +02:00
orklah
ac6a75ea7f
Merge pull request #6473 from orklah/double-assert2
assert both sides of an equality
2021-10-04 13:30:38 +02:00
orklah
0e83afdb86
Merge pull request #6518 from orklah/fix-truthy
improvements of alwaysTruthy/alwaysFalsy
2021-10-04 13:29:49 +02:00
orklah
b0842c6b6f
Merge pull request #6475 from orklah/range6
3> min/max, rand inference improvement with integer range
2021-10-04 13:23:03 +02:00
orklah
66206bf061 fix wrong type description added in signature 2021-10-04 12:26:05 +02:00
orklah
8b07e69645
Merge pull request #6514 from zoonru/if-this-is
Add if-this-is
2021-10-04 09:49:26 +02:00
orklah
8660f68007
Merge pull request #6519 from gmessier/advanced-issue-handlers
Add support for advanced IssueHandler in plugins
2021-10-04 09:47:59 +02:00
orklah
fffe6428de fix tests 2021-10-04 01:13:16 +02:00
orklah
4f696ec3b4 add/fix tests 2021-10-04 01:01:57 +02:00
orklah
ee4dbafca9 fix test 2021-10-02 10:02:24 +02:00
orklah
f641d9e95a assert that some type is a list 2021-10-02 10:02:22 +02:00
orklah
532aa9058b add and fix tests 2021-10-02 10:01:05 +02:00
orklah
597e9a99d7 Makes BooleanNot smarter 2021-10-02 10:01:04 +02:00
orklah
b9f14f8687 improve min/max inference, add a return type provider for rand, mt_rand and random_int 2021-10-02 09:53:58 +02:00
orklah
83ad836e88 assert both sides of an equality 2021-10-02 09:52:19 +02:00
Bruce Weirdan
2e7e343ef8
Merge pull request #6423 from orklah/count-equal-0-negated-assertion 2021-10-02 00:53:03 +03:00
Bruce Weirdan
97a3d673f4
Merge pull request #5091 from ohader/namespace-resolver 2021-10-01 02:00:33 +03:00
Bruce Weirdan
377d3bddf0
Merge pull request #6552 from orklah/manipulator 2021-09-30 21:54:55 +03:00
Bruce Weirdan
d232cc0d02
Merge pull request #6553 from orklah/exec-leak 2021-09-30 21:32:55 +03:00
orklah
4c6f43884c fix test 2021-09-29 22:55:01 +02:00
orklah
2a2e7c5e32 prevent object leaking that lead to changes in callmap 2021-09-29 22:27:34 +02:00
orklah
5a99c9be94 offset the starting position of the function in case of attributes 2021-09-29 21:19:04 +02:00
orklah
9d9dba156c
Merge pull request #6538 from orklah/taint-windows
enable test on taint
2021-09-27 20:37:27 +02:00
orklah
caf4d57438 enable test on taint 2021-09-27 20:16:50 +02:00
orklah
ef82910de3
Merge pull request #6537 from mmcev106/master
Prevent unnecessary filter_var() warnings on primitive types
2021-09-27 20:15:01 +02:00
Mark McEver
79340b4a6f Prevent unnecessary filter_var() warnings 2021-09-27 18:46:01 +01:00
Mark McEver
76dade477d Prevent unnecessary filter_var() warning 2021-09-27 18:34:58 +01:00
Oliver Hader
51333e8f6e
[TASK] Resolve namespace of class related AST statements
This change allows using `Class_` namespaces like in
PhpParser's original `NameResolver` implementation.

```
if ($node instanceof \PhpParser\Node\Stmt\Class_) {
    $fqcn = (string)($node->namespacedName ?? $node->name);
    $extents = (string)($node->extends->getAttribute('resolvedName'));
}
```

Corresponding parts have been duplicated and modified from
https://github.com/nikic/PHP-Parser/blob/v4.10.4/lib/PhpParser/NodeVisitor/NameResolver.php#L69-L81
2021-09-27 11:19:24 +02:00
Guillaume Messier
c9db2dfb53 Merge branch 'master' of https://github.com/gmessier/psalm into advanced-issue-handlers 2021-09-24 12:48:12 +00:00
orklah
b542daf233 more precise test 2021-09-23 21:24:17 +02:00
orklah
85d65d35e9 restrict the test because int size is fixed on runtime environment 2021-09-23 21:24:17 +02:00
orklah
a54e76cbc7 add new issues to baseline and fix a test 2021-09-23 21:24:16 +02:00
orklah
cc6ab8340b improve type when min = max and add test 2021-09-23 21:24:16 +02:00
orklah
a7fa63547e add tests, improve count behaviour on keyed arrays using integer range 2021-09-23 21:24:16 +02:00
orklah
60f017410c
Merge pull request #6526 from orklah/fix-build
fix build
2021-09-23 19:37:06 +02:00
orklah
c74e81ca8f fix build 2021-09-23 19:29:15 +02:00
Guillaume Messier
666367fbd5 Add unit test 2021-09-23 15:30:30 +00:00
741c9ee471
Fixes 2021-09-22 10:26:21 +02:00
ba2c2bdaa2
Fix tests 2021-09-21 13:00:13 +02:00
7e0b489efe
Merge remote-tracking branch 'origin/master' into if-this-is 2021-09-21 12:12:15 +02:00
orklah
55fd9c6713
Merge pull request #6478 from whsv26/bugfix/trait-template-invalid-arg
Fix invalid argument bug in generic trait context
2021-09-20 16:53:12 +02:00
orklah
994c927b6a
Merge pull request #6445 from TysonAndre/negate-in_array-v2
Fix false positive ParadoxicalCondition in negation of in_array
2021-09-20 16:49:15 +02:00