1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-14 10:17:33 +01:00
Commit Graph

7485 Commits

Author SHA1 Message Date
orklah
dd5c2904d8 fix error on continue 2021-10-02 10:01:04 +02:00
orklah
f8c2a89f23 use Int ranges to describe offset after array_fill when both args are known ints 2021-10-02 09:54:02 +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
7e1c66d837 add limit to the number of clauses simplifyCNF can handle 2021-10-02 09:52:19 +02:00
orklah
7f0d25374f add comment 2021-10-02 09:52:19 +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
NikolayZhebet
843f14d069 fix 'Undefined offset: 1' in CodeBase::getTypeContextAtPosition issue (#6559) 2021-09-30 20:09:15 +03:00
orklah
02ef33c4ac
Merge pull request #6554 from simPod/use-a
Use correct English articles
2021-09-30 09:37:56 +02:00
Simon Podlipsky
4f5e30fd30
Use correct English articles 2021-09-30 09:19:08 +02:00
orklah
3133cd159a fix NPE 2021-09-29 22:30:38 +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
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
orklah
ab6efe49b2 fix CS 2021-09-26 23:41:26 +02:00
orklah
38dac34846 unnecessary null initialization 2021-09-26 23:34:32 +02:00
orklah
db395d5605 unnecessary cast 2021-09-26 23:34:32 +02:00
orklah
5d6d3df4cf unnecessary identical child method 2021-09-26 23:34:32 +02:00
orklah
4577a11a2f imports 2021-09-26 23:34:32 +02:00
orklah
c91bdfb689 old casts 2021-09-26 23:34:32 +02:00
orklah
9170b0af8f replace list() 2021-09-26 23:34:32 +02:00
orklah
2315316b17 return types 2021-09-26 23:34:32 +02:00
orklah
72eab30a3a coalesce operator 2021-09-26 23:34:31 +02:00
orklah
f788fec540 static::class 2021-09-26 23:34:31 +02:00
orklah
46801c4b98 clearer string operations 2021-09-26 23:34:31 +02:00
orklah
18b0c63de2 shorter operations 2021-09-26 22:44:33 +02:00
orklah
a95cb15056 no need for parent 2021-09-26 22:39:37 +02:00
orklah
53e4719c19 boolean cast 2021-09-26 22:39:01 +02:00
orklah
ddf74919f6 if with common parts 2021-09-26 22:37:17 +02:00
orklah
c11b32d414 redundant variable check 2021-09-26 22:37:17 +02:00
orklah
998f91aa65 variable with single value 2021-09-26 22:37:17 +02:00
orklah
a85cba3973 dead code 2021-09-26 22:37:17 +02:00
orklah
ae1afd90c6 coalesce operator 2021-09-26 22:37:17 +02:00
orklah
dae29c8cee missing visibility 2021-09-26 22:37:17 +02:00
orklah
6dd1e19254 unnecessary ref 2021-09-26 22:37:17 +02:00
orklah
a5aa824258 unnecessary local variable 2021-09-26 22:37:17 +02:00
orklah
be8406294c unnecessary return 2021-09-26 22:37:16 +02:00
orklah
5777d02fed missing types 2021-09-26 22:37:16 +02:00
orklah
5b684309fd unnecessary ternary 2021-09-26 22:37:16 +02:00
orklah
c45e9bfc5f useless switch 2021-09-26 22:37:16 +02:00
orklah
fce60a018a param defaults 2021-09-26 22:37:16 +02:00
orklah
b65af9bf2f static in final class 2021-09-26 22:37:16 +02:00
orklah
153de33704 weird param always false 2021-09-26 22:37:16 +02:00
orklah
4481428f97 unused param 2021-09-26 22:36:17 +02:00
orklah
c0f6474bc6 merging exceptions 2021-09-26 22:36:17 +02:00
orklah
a03e55a110 array_push misused 2021-09-26 22:36:16 +02:00
orklah
966211e052 unused variable 2021-09-26 22:36:16 +02:00
orklah
afbda6d0f6
Merge pull request #6535 from orklah/SA
Improvements
2021-09-25 20:16:38 +02:00
orklah
a214b14388 CS fix 2021-09-25 18:38:01 +02:00
orklah
f4fa1f7a1b CS fix 2021-09-25 18:35:18 +02:00
orklah
f1e5ecf876 CS fix 2021-09-25 18:28:25 +02:00
orklah
41ea541084 unset instead of reassign 2021-09-25 18:11:54 +02:00
orklah
06da96843a interface compat 2021-09-25 18:09:49 +02:00
orklah
7447489133 better types 2021-09-25 17:57:18 +02:00
orklah
6c892125c3 interface compat 2021-09-25 17:33:12 +02:00
orklah
bff08670f5 put int instead of float 2021-09-25 17:32:04 +02:00
orklah
146d02e3e1 unset instead of reassign 2021-09-25 17:28:51 +02:00
orklah
7891e6136a unparsable types 2021-09-25 17:19:50 +02:00
orklah
cc77abaa40 unparsable types 2021-09-25 17:19:45 +02:00
orklah
748d58a1d6 unparsable types 2021-09-25 17:14:57 +02:00
orklah
89f5c12be2 unparsable types 2021-09-25 17:14:10 +02:00
orklah
a9b1248e9f unnecessary phpdoc is necessary 2021-09-25 17:13:58 +02:00
orklah
671a175deb unnecessary phpdoc 2021-09-25 17:08:51 +02:00
orklah
f0b0540563 unparsable types 2021-09-25 17:08:38 +02:00
orklah
a865090a01 missing types 2021-09-25 17:06:49 +02:00
orklah
04afe1fb86 improved assertion 2021-09-25 16:59:34 +02:00
orklah
7b1ee0924e unnecessary phpdoc 2021-09-25 16:59:23 +02:00
orklah
06f497fca9 missing return 2021-09-25 16:50:14 +02:00
orklah
ebef0de9b4 missing variable 2021-09-25 16:49:53 +02:00
orklah
e61d490662 missing return 2021-09-25 16:49:46 +02:00
orklah
b4e0f83186 unparsable types 2021-09-25 16:47:38 +02:00
orklah
2f82f25934 undefined param 2021-09-25 16:41:22 +02:00
orklah
1f2316f124 polymorphism 2021-09-25 16:40:52 +02:00
orklah
56dcfe8b99 weird syntax + class-string param 2021-09-25 16:34:36 +02:00
orklah
ddcd2e6930 undefined param 2021-09-25 16:31:48 +02:00
orklah
0780b85c30 undefined param 2021-09-25 16:30:38 +02:00
orklah
056f85bbc9 undefined property 2021-09-25 16:25:38 +02:00
orklah
3e6bf6f35f remove unused nullable on param types 2021-09-25 16:05:47 +02:00
orklah
a92fee8ae3 better combining 2021-09-25 11:21:06 +02:00
orklah
97e91e6bf0 code trimming 2021-09-25 02:34:21 +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
e6ba6092a6 turn inside_loop to true for do...while 2021-09-23 21:24:17 +02:00
orklah
d3d11471b7 allow arithmetics on variables as long as we're out of loops 2021-09-23 21:24:16 +02:00
orklah
012b65de78 try to improve behaviour 2021-09-23 21:24:16 +02:00
orklah
2b56d52760 rename vars for better diff 2021-09-23 21:24:16 +02:00
orklah
efde3f9180 change order for better diff 2021-09-23 21:24:16 +02:00
orklah
5ec9e6543d try with everything except Variables 2021-09-23 21:24:16 +02:00
orklah
c6949760f8 activate arithmetic operations on properties too 2021-09-23 21:24:16 +02:00
orklah
a70e7032e9 activate arithmetic operations on method calls too 2021-09-23 21:24:16 +02:00
orklah
c4b47d3786 activate arithmetic operations on func calls 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
ba7f2a5b3b allow range int to be positive 2021-09-23 21:24:16 +02:00
orklah
ea80373006 AssertionFinder refactor 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
7bf9df4360 restore paradox checking 2021-09-23 21:24:16 +02:00
orklah
667eec2ac8 consider count === 0 2021-09-23 21:24:16 +02:00
Morris Jobke
ebf777a5dc
Show file and line in case of an exception in a forked worker
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2021-09-23 20:51:44 +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
Guillaume Messier
87f04bf50b Fix PHPCS errors 2021-09-22 16:22:38 +00:00
Guillaume Messier
6e4b4d0cdf Fix Psalm check errors 2021-09-22 16:14:29 +00:00
Guillaume Messier
12d81fa3b2 Fix inheritance problem using static 2021-09-22 15:24:38 +00:00
Guillaume Messier
ab7fc8a9e5 Remove temporary testing ugly code 2021-09-22 15:20:19 +00:00
Guillaume Messier
97a3f54164 Add support for advanced IssueHandler in plugins 2021-09-22 14:56:07 +00:00
83d596e2e5
Fixes 2021-09-22 10:36:54 +02:00
741c9ee471
Fixes 2021-09-22 10:26:21 +02:00
orklah
9b60c86206
Merge pull request #6508 from thomasbley/master
fixed Uncaught Error: Call to undefined function shell_exec()
2021-09-21 20:39:15 +02:00
f8a959c079
Fix silly bug 2021-09-21 14:11:33 +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
Thomas Bley
6f958fe919 Merge branch 'master' of github.com:thomasbley/psalm 2021-09-20 16:55:58 +02:00
Thomas Bley
e60d9e5ec5 return 1 if shell_exec is not available for getCpuCount() 2021-09-20 16:55:16 +02:00
orklah
d32b1be5a3
Merge pull request #6498 from MorrisJobke/fix/catch-ComplicatedExpressionException-in-ArrayFilterReturnTypeProvider.php
Catch ComplicatedExpressionException in ArrayFilterReturnTypeProvider
2021-09-20 16:53:48 +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
Thomas
ecb368ff2b
Merge branch 'vimeo:master' into master 2021-09-20 12:19:43 +02:00
Thomas Bley
449ef0d994 fixed Uncaught Error: Call to undefined function shell_exec() 2021-09-20 12:18:49 +02:00
orklah
90e1662964
Merge pull request #6241 from orklah/range5
Range arithmetics and assertions
2021-09-20 07:15:43 +02:00
orklah
0f17a2590c fix Mod 2021-09-19 19:30:03 +02:00
orklah
25f78b5d54 refine Mod with positives everywhere 2021-09-19 19:30:03 +02:00
orklah
f87bd56105 fix Pow 2021-09-19 19:30:03 +02:00
orklah
5a2df475ca changes after review 2021-09-19 19:30:03 +02:00
orklah
81e8bf3ff5 allow Literals to be combined with preexisting IntRange 2021-09-19 19:30:03 +02:00
orklah
086d3777eb fix wrong assertion 2021-09-19 19:30:03 +02:00
orklah
3d7dc740c2 fix UnaryMinus 2021-09-19 19:30:03 +02:00
orklah
e75e390449 refactor big methods away 2021-09-19 19:30:03 +02:00
orklah
6b5e6eeecc fix wrong type 2021-09-19 19:30:02 +02:00
orklah
a6630c49a2 fix mod calculation with ranges 2021-09-19 19:30:02 +02:00
orklah
dd9edb7afc fix wrong check for Range validity 2021-09-19 19:30:02 +02:00
orklah
c226285a4b fix Mul and Pow operations 2021-09-19 19:30:02 +02:00
orklah
f789ab0655 add test and allow checking in already inferred types instead of just relying on statements from PHPParser for assertions 2021-09-19 19:30:02 +02:00
orklah
ae0586b0e6 fix shift inference 2021-09-19 19:30:02 +02:00
orklah
bae5b2cf96 remove type when assertion contradicts the current type 2021-09-19 19:30:02 +02:00
orklah
e0e34bec33 allow intersections and add test 2021-09-19 19:30:02 +02:00
orklah
c26f403e7e fix an old bug with inverting positive int + allow inverting TIntRange 2021-09-19 19:30:02 +02:00
orklah
488c13b7c5 handle bit operations and add test 2021-09-19 19:30:02 +02:00
orklah
9994a91915 help Psalm understand the types 2021-09-19 19:30:02 +02:00
orklah
6f050359ce refactor int vs int range arithmetic by converting everything to range and add tests 2021-09-19 19:30:02 +02:00
orklah
0227894176 fix code 2021-09-19 19:30:02 +02:00
orklah
d2f73d3adb fix and test minus case 2021-09-19 19:30:01 +02:00
orklah
d919a53674 rename method too 2021-09-19 19:30:01 +02:00
orklah
9ab46ff3e0 rename class because it handles Div too now 2021-09-19 19:30:01 +02:00
orklah
2dd16f9e22 simplify code 2021-09-19 19:30:01 +02:00
orklah
def7d31566 fix positive-numeric assertion 2021-09-19 19:30:01 +02:00
orklah
6d059b9c8f fix CS 2021-09-19 19:30:01 +02:00
orklah
b5b2677ee3 allow negating inferiorto/superiorto 2021-09-19 19:30:01 +02:00