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

148 Commits

Author SHA1 Message Date
Brown
2930eb3f99 Prevent storing references to classes from within those classes 2020-04-04 18:42:14 -04:00
Brown
72104a52ad Improve file invalidation when using --diff mode 2020-04-02 17:18:04 -04:00
Brown
da729cfbc6 Don’t check params when mutations are being collected 2020-03-31 15:49:43 -04:00
Matthew Brown
47c1470e3b Refactor reference checks to use more appropriate properties 2020-03-28 16:30:56 -04:00
Brown
971ae50bea Do prep work for #3024 - improve handling of absent class references 2020-03-26 12:35:27 -04:00
Brown
a83651050c Seal objectlike arrays inferred from constants 2020-03-23 16:28:20 -04:00
Matthew Brown
43189b3d55 Allow types to be traversed 2020-03-14 23:54:51 -04:00
Matthew Brown
321f1a5e2f Cache trait nodes 2020-03-11 22:14:21 -04:00
Brown
1399b139fc Fix #2951 - use reflection to identify trait when there’s more than one per file 2020-03-09 16:41:46 -04:00
Matthew Brown
17afeae851 Fix support for bitwise or in constant expressions 2020-03-09 00:54:26 -04:00
Matthew Brown
0f5b0fd65d Fix location of traits 2020-03-02 23:07:21 -05:00
Matthew Brown
2cf2ead43b Remove stray comma 2020-03-02 22:30:06 -05:00
Matthew Brown
c0c878cc9d Don’t cache all traits 2020-03-02 22:27:54 -05:00
Brown
86d52bbf4f Remove unused code 2020-03-02 15:49:05 -05:00
Matthew Brown
653353709a Use MethodIdentifier object instead of string 2020-02-14 20:54:26 -05:00
Brown
210d65d0d6 Add a few lowercase-string types 2020-02-13 17:52:23 -05:00
Brown
f141f7c526 Improve --diff checks by including trait-using classes in dependents 2020-02-11 16:39:33 -05:00
Brown
d434f7fb9d Add list identification for late-resolved constants
Fixes #2624
2020-01-15 11:54:01 -05:00
Matthew Brown
9fa2db1b6c Move Union::getTypes to Union::getAtomicTypes 2020-01-04 12:20:26 -05:00
Matthew Brown
02fd1659ef Ignore serialize/unserialize methods
Fixes #2511
2019-12-31 07:56:35 -05:00
Matthew Brown
55c2f7faa2 Fix #2508 - don’t replace templated types with generic ones inside own function 2019-12-28 18:38:02 -05:00
Matthew Brown
6b81f8c64a Fix #2506 - use correct flag when checking classes after analysis 2019-12-24 01:02:34 +00:00
Brown
2e322ee214 Don’t try to fix missing trait method params
Fixes #2427
2019-12-10 17:32:39 -05:00
Brown
b3cf9d3958 Catch circular references in constants
Fixes #2453
2019-12-10 16:16:44 -05:00
Brown
a3e51d6f13 Fix resolution for class names in lazily-evaluated class constants
Fixes #2413
2019-12-04 13:33:50 -05:00
Matthew Brown
aa4daea182 Add extra safety feature 2019-12-03 01:59:36 -05:00
Matthew Brown
97de060df9 Fix #2279 - add parameter typehint by default 2019-12-03 01:49:43 -05:00
Matthew Brown
dd05f6e3ca Speed up missing property type consolidation 2019-12-03 00:57:26 -05:00
Brown
821f3528d2 Fix #701 - indicate issues fixable with Psalter 2019-12-02 15:24:01 -05:00
Matthew Brown
5fe3a4a5a9 Fix #2368 - don’t register class-file mapping
Sometimes it’s not a real class there, just a class_alias call
2019-12-01 23:47:36 -05:00
Matthew Brown
2369bac943 Preserve self refs where possible 2019-11-16 19:59:08 -05:00
Matthew Brown
cbc142671d Fix #2175 - support late-resolved empty arrays 2019-09-27 09:05:56 -04:00
Brown
0ac9108814 Fix #2139 - allow comprehension of constant ternaries 2019-09-17 11:29:41 -04:00
Matthew Brown
0b4981f01b Fix #1551 - do better at inferring class constant types 2019-09-14 14:26:31 -04:00
Matthew Brown
9cbe389285 Fix #910 - dead code issues with abstract vendor method 2019-09-01 16:52:40 -04:00
Brown
a4d57e5524 Fix #2018 - prevent fatal error on class_aliased class reference 2019-08-15 10:17:27 -04:00
2e3s
f15cc7dd5b Mark private properties unused when referenced only in constructor (#1962)
* Mark private properties unused when referenced only in constructor

If a private property is used only in constructor then most likely
it's a dead code since there is no need to have the class property.
But such static properties can be accessed between the calls.

* Ignore the private property issue on alter

* Fix the related dead code psalm

* Add a missing condition into the test
2019-07-21 23:29:16 -04:00
Matthew Brown
74e1b521a5 Add support for completing builtin class names
Fixes #1863
2019-07-17 22:50:57 -04:00
Matthew Brown
ab50c6ce2e Fix #1949 - check that aliased name doesn’t exist before transforming 2019-07-17 20:33:44 -04:00
Matthew Brown
da42be175f Apply PHPCS fixes
Fixes #1880
2019-07-05 16:27:53 -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
aa6677a177 Add autocompletion for some classes
Ref #1822
2019-06-21 17:10:35 -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
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
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
Matthew Brown
2439a9f6a0 Allow instance method renaming, too 2019-06-02 12:02:39 -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
4302596654 Revert "Implement better progress"
This reverts commit 042070d0fd.
2019-05-27 13:07:02 -04:00
Matthew Brown
304ffeb0a3 Revert "Switch to VoidProgress by default"
This reverts commit 63b46be361.
2019-05-27 13:04:38 -04:00
Ilija Tovilo
63b46be361 Switch to VoidProgress by default 2019-05-26 23:18:48 -04:00
Ilija Tovilo
042070d0fd Implement better progress 2019-05-26 23:18:48 -04:00
Matthew Brown
f33745ad25 Fix parameter offset for error 2019-05-13 16:01:41 -04:00
Brown
feff357a75 Be smarter about discovering files 2019-05-10 18:07:13 -04:00
Brown
b6e9fba8e6 Track method param uses between diff runs 2019-04-29 17:29:38 -04:00
Brown
473c8cb832 Fix checks for parent method implementers 2019-04-22 13:18:19 -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
ac562563a7 Don’t remove trait methods 2019-04-17 15:12:52 -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
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
Brown
26e2de93c7 Prepare to enable paralellised use of --find-dead-code
References #1548
2019-04-12 18:28:07 -04:00
Matthew Brown
0da3623372 Prevent internal consumers of classExists from being penalised 2019-03-17 17:11:04 -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
4bbe13e28f Fix #1412 - use proper method name where appropriate 2019-03-01 13:33:23 -05:00
Matthew Brown
cdae79b9fe Fix unnecessary params in Psalm codebase 2019-02-23 11:31:33 -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
8fc0b43973 Fix typecercion issues 2019-02-10 21:13:06 -05:00
Brown
c195e8fd21 Add more nuanced analysis of array access fetch 2019-01-30 15:40:37 -05:00
Matthew Brown
22ee72808a Remove a bunch of hacks around generic offsets
Also fixes #1245
2019-01-26 16:58:49 -05:00
Matthew Brown
c7723df8ff Allow gettype vars to be compared to strings 2019-01-05 16:23:18 -05:00
Matthew Brown
2dc3d9651f Separate iterable into its own type
Fixes #1151
2019-01-04 14:54:40 -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
Brown
341cb0c82c Fix #1125 - check protected method overridden ids for use 2018-12-13 17:20:29 -05:00
Matthew Brown
26947888f6 Add some basic support for class_alias 2018-11-29 00:05:56 -05:00
Brown
0254322bed Migrate Codebase-namespaced and FileManipulation-namespaced classes to internals 2018-11-12 11:20:59 -05:00