1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-13 17:57:37 +01:00
Commit Graph

251 Commits

Author SHA1 Message Date
Matthew Brown
da42be175f Apply PHPCS fixes
Fixes #1880
2019-07-05 16:27:53 -04:00
Matthew Brown
802016757c Fix #1891 - don’t enter class_alias if the class doesn’t exist 2019-07-04 15:46:24 -04:00
Matthew Brown
efe096c7ab Fix #1897 - add support for unions in @psalm-assert annotations 2019-07-04 15:05:55 -04:00
Matthew Brown
36e2ea6881 Fix #1822 - update use statements with classes 2019-06-30 11:12:50 -04:00
Matthew Brown
ca53019d6b Simplify class completion lookup
Ref #1822
2019-06-29 21:32:26 -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
Matthew Brown
fc549a431f Namespace functions 2019-06-29 00:28:31 -04:00
Matthew Brown
f5459e2854 Remove unused var 2019-06-29 00:25:12 -04:00
Matthew Brown
622ad800cc Don’t rescan if the problem is unbalanced braces 2019-06-29 00:22:41 -04:00
Matthew Brown
cb28c44228 Fix #1873 - allow spread operators in inferred property types 2019-06-28 22:28:35 -04:00
Brown
6514f2084c Fix #1860 - be less restrictive about class_exists checks 2019-06-28 10:17:59 -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
Matthew Brown
372a512a86 Don’t convert trait self to trait name 2019-06-26 00:28:43 -04:00
Matthew Brown
c0b86bd40d Use uppercase template_type_extends keys 2019-06-24 23:43:04 -04:00
Matthew Brown
31c8a2e4d7 Add offsets to type tokenisation
Ref #1832
2019-06-22 23:30:40 -04:00
Matthew Brown
2a4072b1be Resolve docblock self refs as soon as possible
Fixes #1827
2019-06-20 23:38:10 -04:00
Matthew Brown
2d5f332ebf Fix #1781 by improving handling of callmap options 2019-06-15 16:10:48 -04:00
Brown
d1630863ad Fix #1787 - prevent initialisation when nullable isn’t set 2019-06-14 16:53:40 -04:00
Brown
c21e9917fa Add config flag to prevent inferring property types from constructor 2019-06-10 14:41:21 -04:00
Brown
aa2fde521a Fix #1703 - infer properties from class params 2019-06-10 12:00:32 -04:00
Matthew Brown
e1255db32a Prevent if checking unless we’re in a top-level if 2019-06-10 00:02:36 -04:00
Matthew Brown
158a2150a7 Fix #1752 - don’t enter if/else when class/interfaces/functions don’t exist 2019-06-09 23:50:28 -04:00
Matthew Brown
395057c6df Fix #1738 - constrain template type when class-string<T> is a param 2019-06-08 11:08:08 -04:00
Brown
b00d51b7db Allow misplaced required params so Psalm still inspects the code 2019-06-07 09:25:12 -04:00
Brown
f309c755f8 Add ability to move classes 2019-06-05 08:50:24 -04:00
Matthew Brown
13779e760e Fix #1736 - forbid | in @psalm-assert 2019-06-05 00:46:55 -04:00
Brown
778b95d335 Add support for moving class constants 2019-06-04 11:14:49 -04:00
Brown
9d1b620f55 Fix too-long line 2019-06-03 11:26:25 -04:00
Brown
2f29dcce93 Fix #1728 - remove extra data in template-extends annotation 2019-06-03 10:28:54 -04:00
Matthew Brown
c569f3932c Use separate method for parsing docblocks 2019-06-01 18:44:59 -04:00
Matthew Brown
62be1cc1b0 Add rest of files 2019-06-01 16:57:33 -04:00
Matthew Brown
736f01c29e Store more accurate return type location 2019-06-01 13:02:20 -04:00
Matthew Brown
909e02d441 Move var docblocks within function 2019-06-01 12:25:57 -04:00
Matthew Brown
dc5a5bcd9d Simplify var docblock parsing signature 2019-06-01 11:53:32 -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
Matthew Brown
fafe73de0a Suppress issue where we don’t want to autoload 2019-05-26 16:40:02 -04:00
Matthew Brown
790bc53bfd Fix #1681 - interpret parent annotation properly 2019-05-25 11:51:09 -04:00
Matthew Brown
13b9e133e4 Fix Psalm errors 2019-05-24 02:15:35 -04:00
Matthew Brown
c80f9d8ecd Add class-based support for key-of
Ref #762
2019-05-24 02:12:58 -04:00
Matthew Brown
574545e149 Add initial support for key-of<T>
Ref #762
2019-05-23 23:53:48 -04:00
Brown
4a434d9a2f Add separate issue for undefined classes in docblocks 2019-05-15 18:41:26 -04:00
Barney Laurance
cd673538f1 psalm-internal - refactor - use snake_case not camelCase 2019-05-14 18:54:16 -04:00
Barney Laurance
ce5d307f83 psalm-internal - present fetching internal property from other namespace 2019-05-14 18:54:16 -04:00
Barney Laurance
b29e041d3c psalm-internal - prevent call to method marked psalm-internal from other namespace 2019-05-14 18:54:16 -04:00
Barney Laurance
4415ef0dbd psalm-internal - prevent invalid extention of class internal to other namespace 2019-05-14 18:54:16 -04:00
Matthew Brown
bfcf3cdc99 Fix #1627 - don’t stub already-stubbed functions 2019-05-13 00:24:31 -04:00
Matthew Brown
307cdbbbb3 Fix #1626 - detect dead code found in #1624 2019-05-12 20:49:37 -04:00
Brown
33d4888228 Fix #1618 - conditionally enable autocompletion for methods and properties 2019-05-09 11:20:13 -04:00
Brown
751253ddf0 Fix #1603 - prevent invalid covariant template classes from being passed 2019-05-06 16:38:08 -04:00
Brown
8c9d8e7249 Add fully-qualified params to scanned classes 2019-05-03 11:55:27 -04:00
Brown
640c1d13a6 Fix unused variables now found in Psalm’s code 2019-05-02 17:21:23 -04:00
Matthew Brown
ec65197f41 Fix #1564 - scan functions if they’re not internal 2019-04-20 17:16:42 -04:00
Brown
80e28d6a4a Add support for unused method & property automated removal 2019-04-17 11:12:18 -04:00
Brown
ff14f671b1 Add hopefully-more-portable method for evaluating method/property usage 2019-04-16 16:07:48 -04:00
Brown
7f8b47c5cf Fix buggy behaviour around callable tests 2019-04-09 18:09:57 -04:00
Brown
1348d634ed Improve handling of variadic parameters 2019-04-09 13:58:49 -04:00
Brown
783f028f70 Fix #1498 - use template types from parent function 2019-03-25 11:25:43 -04:00
Matthew Brown
496a175a9f Fix #1497 - respect constants stubbed in define() calls 2019-03-25 00:07:32 -04:00
bugreportuser
976c2c5ef3 Add an error for throws in global scope 2019-03-24 23:03:37 -04:00
Brown
b9ba24929d Refactor storage of template names to prevent clashes 2019-03-22 15:59:10 -04:00
Matthew Brown
136429dfd4 Fix location of @method docblocks for issues 2019-03-18 21:05:37 -04:00
Matthew Brown
ca765cba58 Fix errors caused by bad generic param counts
Fixes #1474
2019-03-17 12:20:57 -04:00
Matthew Brown
f66af3e267 Fix #1475 - allow self params in traits 2019-03-17 11:31:04 -04:00
Matthew Brown
a0659a02f1 Fix #1418 - support templated union types 2019-03-16 11:15:25 -04:00
Brown
e5f7a5a4bc Coerce class string types together 2019-03-08 17:35:09 -05:00
Matthew Brown
c800fb9282 Fix #1437 - use correct return type line for error 2019-03-07 23:19:17 -05:00
Tyson Andre
6f7295ed13 Remove unused use statements 2019-03-03 22:22:36 -05:00
Matthew Brown
f9b1a63146 Fix #1421 - variadic params are extra 2019-03-02 15:26:18 -05:00
Matthew Brown
ee942b3c02 Fix return type 2019-03-01 00:06:35 -05:00
Matthew Brown
b3c5120d72 Fix #1403 - warn about duplicate templates 2019-02-28 23:43:55 -05:00
Brown
601f303de2 Fix position of invalid param 2019-02-27 16:00:44 -05:00
Brown
1263a2e9a3 Fix missing param location 2019-02-27 14:17:11 -05:00
Matthew Brown
fff56f7b26 Use better heuristic to determine missing types 2019-02-23 11:39:00 -05:00
Matthew Brown
cdae79b9fe Fix unnecessary params in Psalm codebase 2019-02-23 11:31:33 -05:00
Matthew Brown
6671e0dc7c Fix #1382 - flag unused docblocks 2019-02-23 11:02:04 -05:00
Matthew Brown
1c8a573b5f Change TGenericParam to TTemplateParam 2019-02-21 21:40:06 -05:00
Brown
154e1fa38b Fix #1375 - improve treatment of dynamically-declared namespaces 2019-02-21 18:19:12 -05:00
bugreportuser
14ee221075 Fix errors 2019-02-20 10:55:36 -05:00
bugreportuser
cd23a19931 Allow concat for define first arg 2019-02-20 10:55:36 -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
9a8f969d5c Fix #1314 - make sure we always know what a closure is if we’re using one 2019-02-10 16:23:31 -05:00
Matthew Brown
17541b415f Fix #1191 - allow Psalm to check against different versions of PHP 2019-02-07 12:25:57 -05:00
Matthew Brown
822e840d0c Prevent union in function template as 2019-02-05 17:39:11 -05:00
Matthew Brown
899dd16e8f Be more strict about what can be a template as type 2019-02-05 17:26:34 -05:00
Brown
9edbae2bdc Fix possible fatal when builtin function is called in array_filter 2019-01-28 17:54:50 -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
f67bab6d52 Restrict template-extends to actual extends 2019-01-27 21:00:27 -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
cd0a7441d9 Add warnings for extended template param counts off 2019-01-24 17:55:03 -05:00
Brown
0d52dc4e00 Fix #1232 - allow checking of extended templated function returns 2019-01-24 15:03:13 -05:00
Matthew Brown
af19ca4bd5 Only worry if the alias is different to the intended one 2019-01-20 11:29:25 -05:00
Matthew Brown
60088b1189 Fix #1215 - prevent bad code from crashing Psalm 2019-01-20 11:10:12 -05:00
Matthew Brown
394d6509c6 Restrict class-string types to named objects (and intersections) 2019-01-19 22:46:06 -05:00
Matthew Brown
ee2b06ac43 Add initial support for @param-out 2019-01-19 13:32:43 -05:00
Matthew Brown
e2db6a77a6 Allow mixed param overrides for @inheritdoc 2019-01-19 12:46:39 -05:00
Matthew Brown
4f3d7fca0d Fix issue where @inheritdoc could override local param types 2019-01-19 12:42:46 -05:00
Matthew Brown
eddaaea01b Add support for static @method annotations 2019-01-18 11:37:52 -05:00
Matthew Brown
2c55e7aabb Support template-typeof in class again 2019-01-13 14:29:04 -05:00
Matthew Brown
1de0e35545 Add checks for Psalm reserved words in assertions 2019-01-13 14:06:30 -05:00
Matthew Brown
6d462fcb64 Fix #909 - support private trait aliasing 2019-01-13 10:19:27 -05:00
Matthew Brown
a7005014c2 Fix #987 - namespace asserted classes 2019-01-12 11:40:19 -05:00
Matthew Brown
cfcb65aaac Fix #1113 - treat class_alias as always global 2019-01-12 07:28:01 -05:00
Brown
1fddc19172 Add initial support for property types 2019-01-11 17:21:50 -05:00
Brown
9947bc56f6 Fix Psalm errors and improve error output 2019-01-10 19:18:02 -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
Brown
73770c085e Prevent crash when @template as type is missing 2019-01-08 15:11:57 -05:00
Brown
4d959626d5 Fix #1175 - support trait method visibility changes 2019-01-07 11:53:22 -05:00
Matthew Brown
5691c37ece Use reflection to figure out where dupe function was defined 2019-01-06 17:24:46 -05:00
Matthew Brown
a6357b413c Don’t complain when rescanning file with function in 2019-01-06 17:03:13 -05:00
Matthew Brown
214fd7d461 Add DuplicateFunction issue
Fixes #49
2019-01-06 16:40:44 -05:00
Matthew Brown
6f1d56a80f Upcast iterables to traversables when used in a templated class string 2019-01-05 10:32:39 -05:00
Matthew Brown
9d8c2792e2 Add array-key type and improve general type handling
Fixes #1144
2019-01-05 00:15:53 -05:00
Brown
1d300ec342 Fix #1150 2019-01-02 11:18:22 -05:00
Matthew Brown
c4d024a72d Check variable static calls
Fixes #1142 and #1160
2019-01-02 09:00:45 -05:00
Matthew Brown
e89425ad68 Inherit parameters via @inheritdoc 2018-12-21 11:01:24 -05:00
Brown
2e30d7b4a0 Improve handling of unset 2018-12-20 16:03:21 -05:00
Brown
fb848d62e9 Add checks for if (count($a)) and if (count($a) [operator] [number]) 2018-12-19 16:15:19 -05:00
Matthew Brown
ea89a6ba29 Revert "First pass"
This reverts commit 9ed047234f.
2018-12-19 08:45:14 -05:00
Matthew Brown
9ed047234f First pass 2018-12-19 01:59:14 -05:00
Matthew Brown
ca6149ed17 Improve treatment of templated params within function analysis 2018-12-17 23:29:27 -05:00
Matthew Brown
fd0ab47b80 Fix #1118 - detect possible issues with unions of mixed 2018-12-08 13:18:55 -05:00
Matthew Brown
b32000fa05 Fix #689 - add checks for @internal annotations 2018-12-01 18:37:49 -05:00
Brown
ef49e3984b Fix #945 - allow ...$foo in docblock for non-user files to inform variadic 2018-11-30 19:21:14 -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
9efd40e321 Fix #1095 - prevent complex assertion redundant condition 2018-11-29 23:25:30 -05:00
Matthew Brown
21f4a2c7f2 Save referenced classlike for cache 2018-11-29 01:46:12 -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
Matthew Brown
47f5f309ad Remove support for get_class($a) === "somestring"
But it works with class constants
2018-11-28 23:59:43 -05:00
Matthew Brown
af041abdcb Fix #1093 - add exception type to list of scanned classes 2018-11-25 16:14:50 -05:00
Matthew Brown
d90cff8f10 Add support for overriding method visibility too 2018-11-25 11:11:33 -05:00
Matthew Brown
047b096227 Add better support for intersection properties and mocks 2018-11-24 18:31:08 -05:00
Matthew Brown
0f90309819 Do all normalisation on / before conversion to \ 2018-11-18 17:18:05 -05:00
Matthew Brown
fa2e7f1f70 More finagling of windows file names 2018-11-18 17:06:11 -05:00
Matthew Brown
2a3c3ed223 Fix #1071 - improve resolution of include paths 2018-11-18 16:53:46 -05:00
Matthew
b52f9cbcd2 Fix windows file path includes 2018-11-18 20:56:56 +00:00
Brown
d9440c7bb0 Make sure assertions always have a $ in var id 2018-11-14 15:40:56 -05:00
Brown
9f523fab8b Only store really simple-looking code for assertions 2018-11-14 13:53:57 -05:00
Brown
06974221df Change DependencyFinderVisitor name to ReflectorVisitor and update docs 2018-11-13 14:09:43 -05:00
Brown
d0c245eff3 Fix #1077 - queue property types 2018-11-12 13:01:16 -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