1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-14 02:07:37 +01:00
Commit Graph

388 Commits

Author SHA1 Message Date
Sergey Melesh
ee1387473f Fix throws docblock inheritance (#1945) 2019-07-13 10:10:51 -04:00
Brown
12eeb8b320 Fix #1935 - clear stub grandchildren 2019-07-11 18:23:02 -04:00
Brown
7268558aa7 Prevent unnecessary warnings 2019-07-11 11:07:39 -04:00
Matthew Brown
da42be175f Apply PHPCS fixes
Fixes #1880
2019-07-05 16:27:53 -04:00
Matthew Brown
422d9944d8 Fix #1903 - inherit @method from parent interfaces 2019-07-04 22:39:28 -04:00
Ilija Tovilo
67c3726254 Implement signature help - closes #1841 (#1862)
* Implement signature help - closes #1841

* Add explicit signature count

* [LSP] Do analysis for every signatureHelp request

See here: https://github.com/vimeo/psalm/pull/1862#issuecomment-507007346

* Don’t language server information when checking property for init

* Fix signature help for functions

* Add try-catch around signature help Functions::getStorage()
2019-07-01 15:54:32 -04:00
Brown
e876feb0ea Allow users to pass file names to Function::getStorage 2019-07-01 14:20:14 -04:00
Matthew Brown
ca53019d6b Simplify class completion lookup
Ref #1822
2019-06-29 21:32:26 -04:00
Matthew Brown
6b7788b502 Fix FileAnalyzer memory leak 2019-06-29 21:06:21 -04:00
Tyson Andre
791b30a6d8 Fix redundant casts/conditions in psalm (#1874)
This includes a check for array_map that was accidentally an assignment
2019-06-29 12:32:44 -04:00
LeSuisse
f29826b958 Fully qualify constants and function calls (#1849)
This should give a small performance boost.
Part of #1837.

The change is enforced via phpcs and can be autofixed
with phpcbf.
2019-06-26 16:52:29 -04:00
Brown
16bf5f11e1 Fix #1845 - prevent string return when expecting template 2019-06-25 15:06:02 -04:00
Matthew Brown
d96246a824 Improve template handling robustness 2019-06-25 09:06:23 -04:00
Matthew Brown
c0b86bd40d Use uppercase template_type_extends keys 2019-06-24 23:43:04 -04:00
Brown
69b05f5052 Improve handling of parent method calls 2019-06-24 17:45:10 -04:00
Matthew Brown
766b1b0384 Add reference, not type
Ref #1835
2019-06-23 09:10:43 -04:00
Matthew Brown
37ffd6dad6 Fix #1832 - add references to docblock types 2019-06-23 08:47:49 -04:00
Brown
aa6677a177 Add autocompletion for some classes
Ref #1822
2019-06-21 17:10:35 -04:00
Matthew Brown
7fc11af49e Fix docblocks with @andrew-demb’s suggestions 2019-06-16 09:12:32 -04:00
Matthew Brown
41cdde514f Fix #1784 - detect missing end brackets 2019-06-15 17:57:40 -04:00
Matthew Brown
2d5f332ebf Fix #1781 by improving handling of callmap options 2019-06-15 16:10:48 -04:00
Brown
edf3307f84 Fix Psalm errors 2019-06-14 15:55:23 -04:00
Brown
1bc1af140f Move method calls outside classes and __CLASS__ constants 2019-06-14 15:54:15 -04:00
Brown
58b6ce3483 Fix bugs when moving methods that reference each other 2019-06-14 14:41:44 -04:00
Brown
844442e039 Fix #1780 - set open file contents on save 2019-06-13 15:25:55 -04:00
Brown
9c4599a0f0 Add better support for inheriting docblocks 2019-06-11 11:19:57 -04:00
Brown
7cf8c362f0 Fix #1766 - interpret interface parent extends properly 2019-06-11 10:49:39 -04:00
Brown
010f911d22 Fix replacement of local types 2019-06-11 10:33:52 -04:00
Brown
45f2d986e6 Allow multiple class renames at once 2019-06-10 17:09:34 -04:00
Matthew Brown
c0a9ccb385 Fix handling of unused params in threaded mode 2019-06-09 17:02:21 -04:00
Matthew Brown
42cc201e9e Fix #1698 - better understand inherited docblock return types 2019-06-08 09:44:22 -04:00
Matthew Brown
20c66f693e Fix handling of class const types 2019-06-06 18:46:40 -04:00
Matthew Brown
4fc5d1d5c8 Rewrite use statements 2019-06-05 22:13:33 -04:00
Matthew Brown
f327d75116 Add actual file moving 2019-06-05 08:50:24 -04:00
Brown
f309c755f8 Add ability to move classes 2019-06-05 08:50:24 -04:00
Brown
778b95d335 Add support for moving class constants 2019-06-04 11:14:49 -04:00
Matthew Brown
a9809ab28a Add property moving & renaming 2019-06-04 00:32:19 -04:00
Brown
ae8ccdbcd7 Add add info notification to progress 2019-06-03 11:20:42 -04:00
Marco Pivetta
624c7bc6fb Renamed Fn to TFn to allow for PHP 7.4 compatibility 2019-06-03 08:21:25 -04:00
Matthew Brown
fc0f625f62 Add safeguards to prevent bad refactor input 2019-06-02 23:33:57 -04:00
Matthew Brown
2439a9f6a0 Allow instance method renaming, too 2019-06-02 12:02:39 -04:00
Matthew Brown
5eb7cb9b04 Improve file update progress output 2019-06-02 09:59:45 -04:00
Matthew Brown
2b0a17c1c8 Add simple tool to move static methods 2019-06-02 01:10:50 -04:00
Matthew Brown
909e02d441 Move var docblocks within function 2019-06-01 12:25:57 -04:00
Matthew Brown
7e4de611bf Migrate class references in static calls 2019-06-01 10:07:45 -04:00
Matthew Brown
cc89b9254d Add initial ideas for moving static methods
Ref #1595
2019-06-01 00:56:54 -04:00
Brown
a060da95bf Allow MissingParamType alteration to be done in multithreaded mode 2019-05-31 11:55:24 -04:00
Matthew Brown
84c0554595 Get function analyser once per method 2019-05-31 01:49:54 -04:00
Matthew Brown
cd969c51e5 Generate missing param types from callers
Fixes #1707
2019-05-31 01:47:35 -04:00
Ilija Tovilo
5a14e4b1cf Progress bar (#1709)
* Revert "Revert "Implement better progress""

This reverts commit 4302596654.

* Revert "Revert "Implement dots progress bar""

This reverts commit e41733d789.

* Revert "Revert "Switch to VoidProgress by default""

This reverts commit 304ffeb0a3.

* Revert "Revert "Pass success flag to progress""

This reverts commit 62a690ee4e.

* Improve socket communication

* Use an underscore

* Add means to disable progress

* Add extra newline before progress bar
2019-05-30 10:30:41 -04:00
Matthew Brown
962d8f30a1 Fix #710 - treat keyed intersections of iterators properly 2019-05-29 19:58:54 -04:00
Matthew Brown
4302596654 Revert "Implement better progress"
This reverts commit 042070d0fd.
2019-05-27 13:07:02 -04:00
Matthew Brown
e41733d789 Revert "Implement dots progress bar"
This reverts commit 0c5837b246.
2019-05-27 13:05:06 -04:00
Matthew Brown
304ffeb0a3 Revert "Switch to VoidProgress by default"
This reverts commit 63b46be361.
2019-05-27 13:04:38 -04:00
Matthew Brown
62a690ee4e Revert "Pass success flag to progress"
This reverts commit 5e8acf0b0e.
2019-05-27 13:04:33 -04:00
Matthew Brown
c356c452ec Fix #1692 - allow magic annotations on all interfaces without config flag 2019-05-26 23:35:03 -04:00
Ilija Tovilo
5e8acf0b0e Pass success flag to progress 2019-05-26 23:18:48 -04:00
Ilija Tovilo
63b46be361 Switch to VoidProgress by default 2019-05-26 23:18:48 -04:00
Ilija Tovilo
0c5837b246 Implement dots progress bar 2019-05-26 23:18:48 -04:00
Ilija Tovilo
042070d0fd Implement better progress 2019-05-26 23:18:48 -04:00
Brown
4ecf370900 Coerce mixed values when passed as arguments 2019-05-21 11:51:41 -04:00
Brown
963d5bb901 Fix #1656 - allow chained call completion 2019-05-17 12:38:29 -04:00
Brown
0f3385ce95 Use sebastian/diff 2019-05-17 11:26:44 -04:00
Brown
0bd4dbcbc4 Bump to PHP 7.1
Fixes #1650
2019-05-16 18:36:36 -04:00
Brown
6b04503cc4 Fix #1646 - reload functions from cache when not already stubbed 2019-05-16 13:32:31 -04:00
Brown
30cbcb6c36 Add ImplementedParamTypeMismatch issue
Fixes #1633
2019-05-14 15:44:46 -04:00
Matthew Brown
f33745ad25 Fix parameter offset for error 2019-05-13 16:01:41 -04:00
Matthew Brown
bfcf3cdc99 Fix #1627 - don’t stub already-stubbed functions 2019-05-13 00:24:31 -04:00
Matthew Brown
a3a208a7c9 Remove unused variables 2019-05-12 23:13:27 -04:00
Brown
feff357a75 Be smarter about discovering files 2019-05-10 18:07:13 -04:00
Brown
24dbc34bbe Use better solution for inherited more-specific return types 2019-05-09 10:41:30 -04:00
Brown
629eeed3e6 Fix incorrect message when inheriting parent docblock 2019-05-09 10:26:06 -04:00
Brown
44f0c64877 Add extra debugging 2019-05-07 13:16:01 -04:00
Brown
751253ddf0 Fix #1603 - prevent invalid covariant template classes from being passed 2019-05-06 16:38:08 -04:00
Matthew Brown
0fe378a467 Fix #1593 - still inherit more specific docblock from parent when parent has no signature return 2019-05-01 23:14:22 -04:00
Brown
dcfe9bfdc1 Reduce memory load for forked analysis 2019-04-30 15:35:57 -04:00
Brown
b6e9fba8e6 Track method param uses between diff runs 2019-04-29 17:29:38 -04:00
Matthew Brown
b4f24d1fa6 Fix a couple of tests, and track file references to classes 2019-04-28 12:59:36 -04:00
Matthew Brown
e08944cae0 Allow diff mode with --find-dead-code 2019-04-27 17:38:24 -04:00
Brown
29588c9fd8 Add ability to specify GitHub code owners 2019-04-26 11:23:26 -04:00
Brown
473c8cb832 Fix checks for parent method implementers 2019-04-22 13:18:19 -04:00
Matthew Brown
e08ef35b79 Make sure callmap method return types ignore falsable 2019-04-21 11:30:50 -04:00
Brown
f3b7e16160 Shorten line 2019-04-19 12:03:52 -04:00
Brown
205fa36fb7 Add better error messages to unused code issues 2019-04-19 11:45:22 -04:00
Brown
d6de6ca5d5 Prevent removing properties on classes with variable assignment 2019-04-18 14:47:58 -04:00
Brown
1eabe6ed55 Ignore protected properties redefined downstream 2019-04-17 16:55:15 -04:00
Brown
86c6b6fa36 Don’t warn about unused properties that override a used one 2019-04-17 16:41:35 -04:00
Brown
a529f74473 Add support for tracking callables 2019-04-17 15:45:40 -04:00
Brown
ac562563a7 Don’t remove trait methods 2019-04-17 15:12:52 -04:00
Brown
b1044b267d Don’t be greedy with lines 2019-04-17 14:58:13 -04:00
Brown
1f36a85650 Remove extraneous newlines 2019-04-17 13:56:47 -04:00
Brown
fea9faaec5 Allow psalter to be used in multithreaded mode 2019-04-17 13:15:06 -04:00
Brown
80e28d6a4a Add support for unused method & property automated removal 2019-04-17 11:12:18 -04:00
Brown
282dd8e8ab Reduce memory footprint of multithreaded mode 2019-04-16 18:10:26 -04:00
Brown
ff14f671b1 Add hopefully-more-portable method for evaluating method/property usage 2019-04-16 16:07:48 -04:00
Matthew Brown
d145f17782 Fix #1548 - allow parallel execution with --find-dead-code 2019-04-13 15:38:09 -04:00
Matthew Brown
f3b605e442 Fix division by zero bug with --stats
Fixes #1552
2019-04-13 13:41:39 -04:00
Brown
26e2de93c7 Prepare to enable paralellised use of --find-dead-code
References #1548
2019-04-12 18:28:07 -04:00
Brown
6e010d9db9 Remove type coverage map, as it’s not ready for prime-time 2019-04-12 11:32:35 -04:00
Brown
7f8b47c5cf Fix buggy behaviour around callable tests 2019-04-09 18:09:57 -04:00
Brown
808522c36f Add workaround SoapFault::__construct, fixing #1535 2019-04-09 15:06:10 -04:00
Brown
1ab6345bac Fix treatment of PDOStatement::setFetchMode
Fixes #1496
2019-03-29 13:26:13 -04:00
Matthew Brown
230680fd1c Fix #1513 - use correct param types when examining abstract trait methods 2019-03-28 22:47:17 -04:00
Brown
f34a99c0cc Fix #1515 - process inheritance in non-user classes 2019-03-28 17:44:31 -04:00
Brown
8592121799 Populate overridden method ids in separate method 2019-03-28 16:53:07 -04:00
Brown
783f028f70 Fix #1498 - use template types from parent function 2019-03-25 11:25:43 -04:00
Brown
6b0b86b0d9 Ignore class-not-found issues when checking whether to convert PHPStorm annotations 2019-03-25 10:44:40 -04:00
Matthew Brown
9d4ebe6b6b Add plugin hook for post-analysis stuff 2019-03-23 12:47:46 -04:00
Matthew Brown
ee56419fd6 Improve accuracy and durability of mixed counts 2019-03-23 09:50:47 -04:00
Brown
b9ba24929d Refactor storage of template names to prevent clashes 2019-03-22 15:59:10 -04:00
Brown
29666bf22e Fix #1489 - make sure you’re checking against known params 2019-03-21 18:28:25 -04:00
Matthew Brown
0da3623372 Prevent internal consumers of classExists from being penalised 2019-03-17 17:11:04 -04:00
Matthew Brown
9c45f33403 Don’t automatically inherit __construct from parent as overridden method id 2019-03-17 14:16:52 -04:00
Bruce Weirdan
51460e6078 Codebase::classExtends() now rejects unpopulated classes
This is done to prevent false negatives, when class storage hasn't been
populated yet.

Fixes vimeo/psalm#1387
2019-03-17 13:51:00 -04:00
Matthew Brown
a0659a02f1 Fix #1418 - support templated union types 2019-03-16 11:15:25 -04:00
Matthew Brown
b73dd8ebe4 Fix #1447 - always inherit docs from parents 2019-03-16 00:31:17 -04:00
Matthew Brown
312be71be1 Localise overridden templated param types 2019-03-14 10:11:45 -04:00
Brown
e5f7a5a4bc Coerce class string types together 2019-03-08 17:35:09 -05:00
Brown
b3a59d2638 Fix #1435 - prevent classes extending interfaces 2019-03-07 11:16:40 -05:00
Brown
cfa0829a38 Make scanner more accepting of reflection errors 2019-03-04 13:20:19 -05:00
Matthew Brown
f9b1a63146 Fix #1421 - variadic params are extra 2019-03-02 15:26:18 -05:00
Matthew Brown
4bbe13e28f Fix #1412 - use proper method name where appropriate 2019-03-01 13:33:23 -05:00
Matthew Brown
317f790bde
New plugin hooks (#1405)
* Add a bunch of new hooks

* Add more integrations

* Add some broken tests

* Add more things

* Fix remaining interfaces

* Suppress proper issue

* UndefinedMethod should not stop analysis

* Add handlers for two custom method return types
2019-03-01 08:57:10 -05:00
Matthew Brown
3ad1abece4 Add generation of json artifacts 2019-02-24 01:33:25 -05:00
Matthew Brown
cdae79b9fe Fix unnecessary params in Psalm codebase 2019-02-23 11:31:33 -05:00
Matthew Brown
1c8a573b5f Change TGenericParam to TTemplateParam 2019-02-21 21:40:06 -05:00
Brown
d2968081f8 Fix #1370 - allow phpstorm generic iterator 2019-02-20 11:13:40 -05:00
Bruce Weirdan
cb453a8da9 Allow suppressing UnusedClass on specific classes
This allows suppressing UnusedClass with either `referencedMethod` or
`@psalm-suppress`

Fixes vimeo/psalm#1353
2019-02-18 09:32:09 -05:00
Bruce Weirdan
8408effe57 Dropped unused uses 2019-02-17 13:17:45 -05:00
Matthew Brown
356a45a155 Improve ergonomics of PHPStorm meta parsing 2019-02-16 18:50:25 -05:00
Matthew Brown
0739d017ac Use information from .phpstorm.meta.php files in stubs 2019-02-16 11:16:52 -05:00
Matthew Brown
d76459e138 Move to a PHPStan-like return type provider class model 2019-02-15 18:00:40 -05:00
Matthew Brown
8fc0b43973 Fix typecercion issues 2019-02-10 21:13:06 -05:00
Brown
c68209b8f3 Fix #1300 - add functions mentioned in class file where class is used 2019-02-08 17:41:03 -05:00
Matthew Brown
6d0e78540a Only move issue once 2019-02-07 18:47:50 -05:00
Matthew Brown
fbe5801345 Prevent issues being forgotten when another error crops up 2019-02-07 14:06:37 -05:00
Matthew Brown
17541b415f Fix #1191 - allow Psalm to check against different versions of PHP 2019-02-07 12:25:57 -05:00
Brown
3f289731bb Add ability to check descendants in ignored exceptions 2019-01-31 18:40:40 -05:00
Brown
c195e8fd21 Add more nuanced analysis of array access fetch 2019-01-30 15:40:37 -05:00
Brown
3e4c63eb9a Fix template extension in grandchildren 2019-01-28 16:56:42 -05:00
Matthew Brown
081ba4b204 Fix #1072 - add support for @use SomeTrait<T> 2019-01-27 23:12:40 -05:00
Matthew Brown
2d32e4b92a Remove 7.0-incompatible type 2019-01-27 18:43:36 -05:00
Matthew Brown
d8783c277f Add support for getPsalmTypeFromReflectionType 2019-01-27 17:16:22 -05:00
Matthew Brown
22ee72808a Remove a bunch of hacks around generic offsets
Also fixes #1245
2019-01-26 16:58:49 -05:00
Brown
5352084188 Fix #1234 - apply @template-extends to inherited method signatures 2019-01-24 16:09:04 -05:00
Brown
0d52dc4e00 Fix #1232 - allow checking of extended templated function returns 2019-01-24 15:03:13 -05:00
Brown
006801f661 Fix #1233 - inherit docblock return types from interfaces and classes when signature exists 2019-01-24 11:55:59 -05:00
Brown
184ee76176 Remove erroneous regular namespace check
Fixes #1235
2019-01-24 10:41:06 -05:00
Matthew Brown
8bc17e47be Fix #1227 - allow genric params in @psalm-assert 2019-01-22 23:42:54 -05:00
Matthew Brown
5cc3fe6b67 Fix #760 - coerce __invoke method to closure 2019-01-21 17:08:12 -05:00
Matthew Brown
590bea305d Fix #1218 - find issues with bad callables 2019-01-19 19:49:58 -05:00
Matthew Brown
9c5ef33997 Allow @property to override parent class property type
Fixes #1214
2019-01-19 14:26:27 -05:00
Matthew Brown
4f3d7fca0d Fix issue where @inheritdoc could override local param types 2019-01-19 12:42:46 -05:00
Matthew Brown
11dc78fd76 Don’t override local docblocks when inheritdoc is present 2019-01-19 12:30:14 -05:00
Matthew Brown
9bd5f06c7d Allow inheritdoc to propogate param types 2019-01-19 12:19:07 -05:00
Matthew Brown
94af3b6c51 Add automatic inheritance to properties
Fixes #1210
2019-01-19 10:09:26 -05:00
Brown
1ac51fcea6 Allow binding params of extended templates
Fixes #1207
2019-01-16 12:07:30 -05:00
Matthew Brown
9ef1ce1535 Make @template-extends more robust 2019-01-12 18:18:23 -05:00
Matthew Brown
cfcb65aaac Fix #1113 - treat class_alias as always global 2019-01-12 07:28:01 -05:00
Matthew Brown
ff958ef643 Fix inheritance of method params 2019-01-11 08:54:10 -05:00
Brown
0d28d5d82b Add check for @template-extends return types 2019-01-10 19:01:30 -05:00
Brown
ddc2637fc5 Add support for @template-extends Foo<SomeClass> 2019-01-10 17:58:32 -05:00
Brown
f108badd03 Fix #1067 - add support for @template-extends 2019-01-10 16:59:44 -05:00
Brown
b8d822cd26 Prohibit leaking of template params across class boundaries 2019-01-10 12:13:49 -05:00
Matthew Brown
d3324b42fa Remove slashes from is_a and is_subclass_of string classes, and scan them 2019-01-09 08:49:02 -05:00
Matthew Brown
370874d9b6 Make diff map more verbose so it can serve as a list of safe zones
Outside them all issues must be removed
2019-01-08 00:54:48 -05:00
Matthew Brown
c7723df8ff Allow gettype vars to be compared to strings 2019-01-05 16:23:18 -05:00
Tyson Andre
d85c9d8aa2 Remove an unused closure use variable
This looks like debugging code added in
37dedee7b6
2019-01-05 15:48:48 -05:00
Matthew Brown
2dc3d9651f Separate iterable into its own type
Fixes #1151
2019-01-04 14:54:40 -05:00
Brown
9fdf29c468 Fix #1165 - default inherited unresolved constants to mixed 2019-01-02 13:46:46 -05:00
Matthew Brown
c4d024a72d Check variable static calls
Fixes #1142 and #1160
2019-01-02 09:00:45 -05:00
Matthew Brown
df9ea9e3b6 Potential fix for #1156 2019-01-02 08:03:24 -05:00
Matthew Brown
901596281c Fix #1143 - check some variable new calls 2019-01-02 06:58:49 -05:00
Matthew Brown
947e3bf0f1 Fix crashes when analysing aliased class instances 2018-12-21 11:32:44 -05:00
Matthew Brown
e744e71946 Fix class_alias treatment for interfaces and others 2018-12-21 09:29:23 -05:00
Matthew Brown
02003d9996 Understand class_alias calls better
Ref #1135
2018-12-21 01:21:00 -05:00
Brown
341cb0c82c Fix #1125 - check protected method overridden ids for use 2018-12-13 17:20:29 -05:00
Matthew Brown
fa9a04369b Don’t propagate internal to methods/properties of traits and interfaces 2018-12-13 09:28:30 -05:00
Matthew Brown
b32000fa05 Fix #689 - add checks for @internal annotations 2018-12-01 18:37:49 -05:00
Brown
9e4765663d Fix #999 - respect @method annotations to redefine parent methods 2018-11-30 15:13:25 -05:00
Brown
1b740aebb5 Fix #1104 - allow multiple trait method aliases to map to same method 2018-11-30 13:45:49 -05:00
Matthew Brown
1eb11a43b0 Fix #1102 by supporting class_alias properly 2018-11-29 00:46:34 -05:00
Matthew Brown
26947888f6 Add some basic support for class_alias 2018-11-29 00:05:56 -05:00
Brown
ca602f8e17 Fix language server crash after editing trait method names 2018-11-20 15:51:47 -05:00
Matthew Brown
37dedee7b6 Fix memory leak issues and disable garbage collection 2018-11-18 11:39:14 -05:00
Brown
766f33d6e4 Fix add in missing property in LSP mode 2018-11-15 18:10:10 -05:00
Brown
dc834fdb01 Default allowStringToStandInForClass to true and fix errors found 2018-11-12 12:03:55 -05:00
Brown
0254322bed Migrate Codebase-namespaced and FileManipulation-namespaced classes to internals 2018-11-12 11:20:59 -05:00