Bruce Weirdan
6abce3525a
Enforce use
sort ( #5900 )
2021-06-07 22:55:21 -04:00
Matt Brown
4f9067f5c8
Fix unused properties in Psalm’s own codebase
2021-05-21 09:15:23 -04:00
Bruce Weirdan
d57dde0d15
Allow phantom classes in instanceof expression ( #5498 )
...
Fixes vimeo/psalm#5481
2021-03-29 00:11:45 -04:00
Matt Brown
96e0743892
Fix #5325 – remove all memoised methods when calling a method with property mutations
2021-03-05 00:39:25 -05:00
Matt Brown
924f6b6f94
Propagate mutation removal up the context parent tree
...
Fixes #5231
2021-02-25 18:11:58 -05:00
Matt Brown
2f58c6afc8
Fix #5020 - remove previous catch var assertions when assigning inside catch
2021-01-17 14:28:28 -05:00
Matt Brown
d10a06837d
Fix #5001 - update variables after context after type change from empty
...
Empty is the invalid state, and some old logic here was causing a bug
2021-01-13 11:35:52 -05:00
orklah
09fb141e49
Document lowercase-string when possible ( #4904 )
...
* document lowercase-string
* fix missing strtolower
2020-12-29 11:42:12 +00:00
Matt Brown
524084a64c
Tighten up rules arouund when mutation-free methods get memoised
2020-12-08 16:39:06 -05:00
Matt Brown
dff2943096
Fix #4794 - invvalidate dependent types when their variables change
2020-12-06 18:16:22 -05:00
Matt Brown
9daa534656
Ensure we flush out re-assigned vars also referenced
...
Fixes #4488
2020-11-06 12:51:41 -05:00
Matt Brown
024d93b7fd
Fix #4467 - variables are only the same if they were set in the same location
2020-11-01 11:26:42 -05:00
orklah
ceaaa39ec3
improve phpdoc ( #4352 )
2020-10-17 12:36:44 -04:00
orklah
62e79fb7ea
param types ( #4313 )
2020-10-12 15:46:47 -04:00
orklah
10f2966dcb
return types ( #4311 )
...
* return types
* remove willReturn for void methods
2020-10-12 15:02:52 -04:00
Matt Brown
14efde286f
4.x - refactor unused variable detection
...
This turns unused variable detection into an explicit control-flow problem, where before we had a more simplistic mark-and-sweep algorithm
2020-09-30 12:28:13 -04:00
orklah
37a2f8a33d
unused use statements ( #4228 )
2020-09-22 01:10:46 -04:00
Brown
3e0f449163
Detect more issues inside finally block
2020-09-21 15:16:19 -04:00
orklah
ead107fa9e
More return types ( #4173 )
...
* add native return types
* redundant phpdoc
2020-09-12 11:24:05 -04:00
orklah
8c7423505a
add native param types ( #4137 )
...
* add native param types
* redundant phpdoc
* add more param types and adds "?" to nullable types
* remove redundant phpdoc
* add more param types and remove redundant phpdoc
* add more param types and remove redundant phpdoc
2020-09-06 19:36:47 -04:00
orklah
f66d57f19d
add native return types ( #4116 )
...
* add native return types
* remove redundant phpdoc
2020-09-04 16:26:33 -04:00
Brown
988e17f11d
Make clause fully immutable
2020-08-26 15:35:29 -04:00
Brown
8ad1c2eeb1
Use immutable data structures for clause calculations
2020-08-26 10:41:47 -04:00
Brown
b168777236
Fix #3924 - remove descendants after reconciled change
2020-08-03 02:06:42 -04:00
kazusuke sasezaki
94002367ba
fixed typo ( #3883 )
2020-07-24 09:34:05 -04:00
Matthew Brown
1b752d06ab
Fix #3201 - add additional constraints on constructor initialisation
2020-04-21 00:04:47 -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
Matthew Brown
6c7f89b0ab
Fix #2920 - track unevaluated code after nested returns
2020-03-15 14:31:41 -04:00
Matthew Brown
4707b21227
Fix tests
2020-02-21 22:15:25 -05:00
Brown
15808458cc
Better understand nesting loops and switches
...
Fixes #2700
2020-01-27 12:17:12 -05:00
Brown
e68ca6a20b
Fix #2661 - catch invalid array_push on property
2020-01-22 09:57:59 -05:00
Matthew Brown
1b7b71f2ca
Fix #2591 - always remove changed var from parent clauses
...
Even when there are no child clauses due to an assertion
2020-01-10 23:46:45 -05:00
Matthew Brown
9fa2db1b6c
Move Union::getTypes to Union::getAtomicTypes
2020-01-04 12:20:26 -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
Brown
2469f04715
Improve reconciliation of arrays with constant offsets
2019-12-13 17:17:14 -05:00
Matthew Brown
83b10bb9af
Fix #2426 , or at least some of it
2019-12-08 00:49:34 -05:00
Matthew Brown
df395944f8
Change how $changed_var_ids is communicated
2019-12-07 01:23:35 -05:00
Brown
353cf2351e
Fix #2259 - if error suppression is use, list destructuring values will be nullable
2019-10-22 10:40:37 -04:00
Brown
16c33d1565
Add support for list type
...
Fixes #2209
2019-10-08 18:44:46 -04:00
bugreportuser
064d4886c3
Track exception suppressions ( #2211 )
2019-10-04 14:01:58 -04:00
Brown
ebe8bedb20
Allow assertions on class constants
2019-10-03 18:13:04 -04:00
Brown
b7b4baff8f
Add support for @immutable
...
Fixes #1272
2019-08-30 12:36:35 -04:00
Brown
236a7ffd15
Fix #2027 - fix improperly retained callable check
2019-08-16 10:32:03 -04:00
Brown
b5614d03f8
Add detection for unused function calls
2019-08-13 13:15:23 -04:00
Matthew Brown
60c0133fff
Break apart reconciler
2019-08-10 13:22:21 -04:00
Matthew Brown
3df248eea2
Add concept of purity to functions and methods
2019-07-18 01:31:48 -04:00
Matthew Brown
da42be175f
Apply PHPCS fixes
...
Fixes #1880
2019-07-05 16:27:53 -04:00
Matthew Brown
6b7788b502
Fix FileAnalyzer memory leak
2019-06-29 21:06:21 -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
c66a106622
Improve performance by doing less cloning
...
Ref #1837
2019-06-26 00:14:06 -04:00
Matthew Brown
cd969c51e5
Generate missing param types from callers
...
Fixes #1707
2019-05-31 01:47:35 -04:00
Matthew Brown
4f8d6a50d8
Don’t emit MissingClosureReturnType when inside call and type can be inferred
2019-05-06 20:47:55 -04:00
Matthew Brown
9be8013633
Add a way to ignore variable method & property calls
2019-04-20 17:49:49 -04:00
bugreportuser
f5e03715f3
Fix memory leak
2019-04-02 23:36:55 -04:00
bugreportuser
1a4b9ab25f
Allow suppressing exception issues inline
2019-03-31 14:22:19 -04:00
bugreportuser
4fc7e4affc
Give errors for all uncaught exceptions
2019-03-31 14:22:19 -04:00
bugreportuser
8b12751007
Keep track of throw code locations
2019-03-24 23:03:37 -04:00
bugreportuser
e31cfa503d
Allow reconciling superglobal types
2019-03-16 12:49:38 -04:00
bugreportuser
806ce145ea
Fix PHP7 error
2019-03-11 15:53:21 -04:00
bugreportuser
0e9fb04f06
Define globals in more places
2019-03-11 15:53:21 -04:00
Matthew Brown
8650f9eb1a
Fix #1356 - improve assertion system to work better on function calls
2019-02-26 01:03:33 -05:00
Bruce Weirdan
8408effe57
Dropped unused uses
2019-02-17 13:17:45 -05:00
Matthew Brown
194bb31221
Fix #204 - allow missing param types to be added with Psalter
2019-02-02 14:16:49 -05:00
Matthew Brown
3a01afbe0a
Refine inferred type when possible
2019-02-02 12:10:52 -05:00
Matthew Brown
db89b3cc3f
Add initial support for fixing MissingParamType
2019-02-02 11:28:48 -05:00
Brown
74ebb0b2d5
Don’t copy context unnecessarily when checking methods had no effect
2019-01-31 12:55:48 -05:00
Matthew Brown
8bc17e47be
Fix #1227 - allow genric params in @psalm-assert
2019-01-22 23:42:54 -05:00
Brown
8e5e3564bc
Fix erroneous redundant condition warning
2018-12-19 16:10:09 -05:00
Matthew Brown
fd0ab47b80
Fix #1118 - detect possible issues with unions of mixed
2018-12-08 13:18:55 -05:00
Matthew Brown
37dedee7b6
Fix memory leak issues and disable garbage collection
2018-11-18 11:39:14 -05:00
Matthew Brown
4d79b61e93
Change _checker to _analyzer
2018-11-12 11:20:59 -05:00
Matthew Brown
4688b25fd9
Move internal classes to own namespace
2018-11-12 11:20:59 -05:00
Brown
67c90edadf
Don’t check methods we’ve already checked
2018-09-30 11:34:51 -04:00
Matt Brown
f844f86a6c
Improve type coercion checks in strict mode
2018-08-28 17:42:39 -04:00
Matthew Brown
2fee699d25
Fix #908 - dont’t emit UnresolvableInclude after file_exists check
2018-08-09 23:29:30 -04:00
Matt Brown
5bb5bb2476
Check this properties for redundant conditions
2018-07-10 12:32:53 -04:00
Matthew Brown
21001668df
Don’t double-quote string
2018-07-10 00:39:33 -04:00
Tyson Andre
a3b1bebb5b
Fix misuse of preg_quote ( #869 )
...
1. Variable ids can contain slashes or dots, e.g. for `${'my/var'} = 2`
or psalm's local representation of properties or array indexes
(I forget which)
2. preg_quote's escape character should **always** be the same as the
pattern starting character.
Using DIRECTORY_SEPARATOR will fail to escape '/' on windows.
2018-07-06 19:16:31 -04:00
Matthew Brown
e3ae1bf26f
Fix #15 - check for uncaught throws if config flag is set
2018-06-22 01:13:49 -04:00
Matthew Brown
fa51c39902
Improve dead code analysis of switch statements
2018-06-16 21:54:44 -04:00
Matthew Brown
3670f066bb
Improve dead code detection
2018-06-16 20:01:41 -04:00
Matthew Brown
b0733254bb
Use individual type objects for each string ( #757 )
...
* Experiment with individual types for each string
* Fix bunch of errors
* Fix a few more issues
* Fix a whole bunch of bugs
* Fix most remaining bugs
* Fix isset warnings
* Fix psalm errors in psalm
* Limit big string size
* Fix falsiness of ints
* Fix issue with type widening, allowing value set in nested if to be altered
* Don’t complain if type is mixed
* Add skipped-for-now test
* Add specific test to address issue
2018-05-18 11:02:50 -04:00
Matt Brown
a0281e5716
Improve clause eradication after ifs
2018-05-14 16:29:51 -04:00
Matthew Brown
61aeea6375
Fix whole bunches of things
2018-05-07 01:26:06 -04:00
Matthew Brown
1a4ddc7cdd
Support value types ( #707 )
...
* Add first idea
* Add initial count experiments
* Remove false positives
* Fix getId to support changes in conditionals
* Add better tests
* Strip types when not exists
* Fix array offsets
* More fixes
* Add class constant value types
* Clone constants everywhere
* Don’t complain unnecessarily
* Be more lenient with possibly invalid __sets
* Fix mixed issues
* Fix bug concerning orred string equality
* Remove unnecessary casts
2018-05-03 13:56:30 -04:00
Matthew Brown
35725267f9
Fix #691 - Allow comparisons to float for integer results
2018-04-24 23:02:20 -04:00
Matt Brown
1f3837d972
Fix #686 - allow undefined class inside class_exists call
2018-04-19 12:16:00 -04:00
Matt Brown
6ae39c84fc
Use more locals
2018-04-13 11:28:15 -04:00
Matt Brown
60c6bb4021
Fix #650 - be more judicious about inserting mixed into places
2018-04-06 18:28:22 -04:00
Matthew Brown
4175d1a887
Add PossiblyUndefinedVariable warning when using possibly undefined array key
2018-03-17 17:35:36 -04:00
Matthew Brown
67312be2a9
Fix #562 - allow if/else blocks to initialise vars
2018-03-08 09:30:31 -05:00
Matthew Brown
88ca7d2fa7
Fix #515 - make Psalm aware of variable array keys
2018-02-17 11:24:08 -05:00
Matthew Brown
24416feb62
Improve handling of unset calls with possibly undefined variables
2018-02-10 10:30:08 -05:00
Matt Brown
1df4c3d196
Add DocblockTypeContradiction to find possible issues with docblock types
...
Fixes #491
2018-02-06 18:44:53 -05:00
Matthew Brown
44b8b22995
Improve checks for unused variables and params
2018-01-28 17:28:34 -05:00
Matthew Brown
8b740110f4
Remove more ? from docblocks
2018-01-28 17:07:09 -05:00
Matthew Brown
7ce053bd8a
Make docblocks sligtly more phpdoc-compatible
2018-01-28 16:52:57 -05:00
Matthew Brown
ea28ee709d
Improve unused variable detection slightly
2018-01-25 01:04:26 -05:00
Matt Brown
72a4f148ff
Prevent infinite loops when analysing private functions that call each other
2018-01-24 13:11:23 -05:00