Matt Brown
3dd185e395
Fix #4537 - use more rigorous inerhitance for return and param types
2020-11-12 13:54:27 -05:00
Matt Brown
b7551e712a
Use better way to determine which signture to use
...
Fixes #4524
2020-11-11 19:22:23 -05:00
Matt Brown
2f7bf2a144
Bind lower bounds to upper bounds as well when no upper bound can be inferred
...
Ref #4485
2020-11-11 17:46:09 -05:00
Matt Brown
a8d7248c31
Fix #4524 - do better template param inheritance
2020-11-11 13:25:17 -05:00
Matt Brown
388e804ed8
Allow opt-in to strict return type checking
2020-11-05 18:20:04 -05:00
Matt Brown
67554dd017
Fix #4453 - sanitise @extends types before attempting to parse
2020-10-30 15:08:23 -04:00
Matt Brown
fce5c26600
Remove subpar test
2020-10-28 13:55:51 -04:00
Matt Brown
d27d86a84c
Fix #4422 - be aware of nested template params
2020-10-27 10:01:17 -04:00
Matt Brown
f3cc7a7f2f
Break apart ReflectorVisitor
2020-10-23 19:53:04 -04:00
Matt Brown
2902a8cc60
Fix #4326 - Prevent later remapping of properties
2020-10-14 21:35:57 -04:00
Matt Brown
4539a2f27e
Fix #4326 - prevent more mapping than necessary
2020-10-14 21:22:51 -04:00
Pol Dellaiera
31c924c314
Add more standard iterators ( #4320 )
...
* Add CachingIterator, LimitIterator, InfiniteIterator, CallbackFilterIterator, NoRewindIterator.
Signed-off-by: Pol Dellaiera <pol.dellaiera@protonmail.com>
* Add related Iterator tests.
Signed-off-by: Pol Dellaiera <pol.dellaiera@protonmail.com>
2020-10-13 11:35:49 -04:00
Matt Brown
fcfa746ba8
Fix #4310 - prevent literal class check on union
2020-10-12 14:45:11 -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
8f8dbfbd72
Fix #4122 - detect yield in function arguments
2020-09-13 17:13:26 -04:00
orklah
ead107fa9e
More return types ( #4173 )
...
* add native return types
* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
00ad09816f
Fix tests
2020-09-10 19:05:47 -04:00
Brown
92239add4d
Add some backwards-incompatible changes for 4.x
2020-08-30 11:44:14 -04:00
Brown
9878613594
Refine iterable key after is_array check
...
Ref #4038
2020-08-26 11:00:38 -04:00
Brown
57ac0a3310
Refine test for windows compat
2020-08-25 17:37:37 -04:00
Brown
59e7f69d7b
Fix get_class-inferred templating
2020-08-25 17:25:05 -04:00
Brown
6ab3e732fb
Fix #4038 - don’t remove null types unnecessarily in mixed union
2020-08-25 15:50:33 -04:00
Brown
6e1218065d
Preserve intersections when expanding templated types
...
Fixes #4043
2020-08-25 14:12:57 -04:00
Bruce Weirdan
4dcb7183f5
Fix windows tests ( #4040 )
...
* Fix windows tests by not mangling the expectations
* Use platform-dependent directory separator in expected messages
* fix CS
2020-08-22 10:00:36 -04:00
Matthew Brown
5c20a5295e
Improve solution to #3964
2020-08-16 13:03:30 -04:00
Matthew Brown
a356a43a51
Fix #3964 - prevent incorrect intersection of unions
2020-08-16 12:26:07 -04:00
m0003r
e81593f359
Localize types on magic properties ( #3971 )
...
* Fix #3949 - localize types on magic properties
* fix failing tests
* fix code style
Co-authored-by: m03r <m03r@m03r.net>
2020-08-10 12:45:21 -04:00
Matthew Brown
6085e42fc1
Detect mismatching param names effectively
2020-08-10 09:58:43 -04:00
Brown
afce2dc66f
Tighten up rules around instantiation a bit more
2020-08-06 10:18:55 -04:00
Brown
c0b0036109
Fix #3934 - prevent unsafe use of new static
2020-08-05 19:39:27 -04:00
Brown
1c8f9e94b1
Fix #3907 - allow template as types to be refined via instanceof
2020-07-29 17:46:45 -04:00
Brown
873970a4d1
Recursively transform template types before comparison
...
Fixes #3887
2020-07-24 14:47:24 -04:00
Brown
92fe9898a1
Fix #3879 - ensure interface templates are extended where nececssary
2020-07-24 11:29:36 -04:00
Brown
76bd5b6278
Refactor type comparison
2020-07-21 19:40:35 -04:00
Brown
ae89a71c84
Prevent false-positive comparing template to true
2020-07-21 12:59:50 -04:00
Brown
8349564cc4
Fix #3790 - removing false/null from template not redundant
2020-07-10 13:19:23 -04:00
Brown
ba44b952ba
Skip failing test
2020-07-10 13:08:50 -04:00
Brown
cd8420aa94
Skip optimisation for unpacked args
2020-07-10 13:04:37 -04:00
Brown
8ecee6df6d
Fix #3760 - prevent param remapping twice
2020-07-07 11:44:22 -04:00
Brown
ab6df0a5d1
Fix #3753 - resolve self-references in trait as statements earlier
2020-07-05 12:05:25 -04:00
Brown
5da29955ee
Use better replacement when analysing potentially-inherited templated type
2020-07-03 12:25:33 -04:00
Brown
6419788a49
Remove false from template param as necessary
...
Fixes #3737
2020-07-03 01:07:50 -04:00
Brown
ea82cdc6ea
Fix #3726 - infer generic template from class-string
2020-07-02 01:11:46 -04:00
Brown
fa0f43f0cf
Skip failing test
2020-07-02 00:22:14 -04:00
Brown
ae7c5b095b
Fix #3712 - allow taints to be suppressed with @psalm-suppress
2020-07-01 23:23:45 -04:00
Brown
137647a1a0
Fix #3603 - better typed value comparisons for loose equality
2020-06-18 09:31:38 -04:00
Brown
0a8b9b56ab
Fix #3600 - conditional return should be removed before comparison
2020-06-17 12:57:50 -04:00
Matthew Brown
427f470806
Fix #3586 - ensure templated trait params more accurate
2020-06-13 16:37:39 -04:00
Matthew Brown
74a34f066c
Don’t check classes if literal strings are allowed
...
Fixes #3538
2020-06-06 19:31:42 -04:00
Brown
fcf0a681d9
Fix #3531 - ignore mixed returns from template
2020-06-06 10:33:49 -04:00
Brown
be8fd3ea19
Fix #3481 - treat an iterable like a Traversable when comparing to object
2020-05-31 01:22:43 -04:00
Brown
4e21e54ee1
Fix #3491 - provide correct types for substitution
2020-05-30 19:11:41 -04:00
Brown
3da3d61270
Fix #3434 by removing extraneous call to simplifyType
2020-05-26 17:55:54 -04:00
Brown
043c4b2a98
Skip test that requires ext-ds
2020-05-25 18:47:59 -04:00
Brown
7e7456c863
Make taint checks more thorough
2020-05-25 17:10:53 -04:00
Brown
109920be88
Expand template param before comparison
2020-05-25 11:51:10 -04:00
Brown
be847472a2
Fix #3453 - allow conditional return types on instance methods
2020-05-25 09:39:30 -04:00
Matthew Brown
4f33330215
Add nullable type
2020-05-22 13:18:18 -04:00
Brown
bebfac0ab6
Fix #3426 - allow falsy reconciliation for templated params
2020-05-22 13:16:48 -04:00
Brown
1b84fc2c12
Fix #3419 - don’t add null to return type when template/conditional return is used
2020-05-22 12:44:19 -04:00
Matthew Brown
6784a90b2f
Fix #3423 - allow conditional with func_num_args() in namespace
2020-05-21 11:29:54 -04:00
Matthew Brown
952216ff21
Fix test
2020-05-20 23:24:50 -04:00
Matthew Brown
2d02064962
Fix #3407 - allow multiple matching generic classes in union
2020-05-20 09:11:17 -04:00
Brown
f335560b69
Allow setting property on templated type
2020-05-19 17:31:05 -04:00
Matthew Brown
4dd0a2b775
Fix #3380 - allow comparisons between template param and empty array
2020-05-16 16:41:07 -04:00
Matthew Brown
8c236f411a
Fix #3353 - allow extending nested when nested as type is mixed
2020-05-12 15:07:16 -04:00
Brown
3e16aec33c
Remap generic template params where necessary
...
Fixes #3325
2020-05-08 22:55:18 -04:00
Brown
a089d8bd58
Fix #3296 - propagate final flag to static calls in return types
2020-05-03 20:42:06 -04:00
Brown
bf5e178d16
Fix #3289 - treat property on non-generic type like actual value
2020-05-02 23:37:59 -04:00
Brown
07e5250292
Fix #3273 - add support for func_num_args() in conditional type
2020-05-01 16:02:53 -04:00
Brown
0d8b56dc78
Fix return type coalescing for conditional return types
2020-05-01 13:04:48 -04:00
Brown
6024447ca0
Expand function-based template types before comparing against inherited
...
Fixes #3276
2020-05-01 12:40:10 -04:00
Brown
d1b10341de
Remove suppression
2020-04-28 22:37:20 -04:00
Brown
63c190ff83
Fix #3257 - refine as type and clone where necessary
2020-04-28 22:26:54 -04:00
Brown
a670aa7ddc
Fix #3214 - allow if/else branches of conditional to both be arrays
2020-04-22 16:07:13 -04:00
Brown
52c0346b65
Fix #3213 - make sure static is bound from a static call with set class
2020-04-22 11:34:46 -04:00
Brown
8f57d0c738
Fix #3204 - normalise function ids where possible
2020-04-20 21:38:35 -04:00
Brown
6fc18af42e
Fix #3163 - map object-like arrays too
2020-04-19 18:46:24 -04:00
Brown
2188b6736f
Fix #3162
...
Descend into inherited templates to prevent function-defined templates mapping inappopriately
2020-04-19 12:19:39 -04:00
Brown
3e07684855
Fix iterable coercion for Traversable-extending types
...
Fixes #3159
2020-04-19 09:15:20 -04:00
Brown
d2d795018f
Fix #3138 - fix inherited property template type inference
2020-04-18 16:57:13 -04:00
Brown
8d29b27204
Allow assigning null to template with null potential
2020-04-18 15:34:14 -04:00
Brown
b0455adced
Fix #3177 - prevent crash by using inherited templates
2020-04-18 11:48:22 -04:00
Brown
5180ce1f54
Improve template assertion reconciliation
...
Fixes #3144
2020-04-18 11:22:06 -04:00
Valentin Udaltsov
9b8e8ab964
Support non-empty-arrays in array_keys ( #3168 )
...
Closes #3160
2020-04-18 00:56:54 -04:00
Matthew Brown
aa29c7fc9e
Revert "Support non-empty-arrays in array_keys ( #3168 )" ( #3172 )
...
This reverts commit a280e57ecf
.
2020-04-17 16:52:08 -04:00
Valentin Udaltsov
a280e57ecf
Support non-empty-arrays in array_keys ( #3168 )
...
Closes #3160
2020-04-17 15:07:41 -04:00
Brown
aa3846758e
Fix #3153 - narrow template types in conditional branches
2020-04-17 09:53:58 -04:00
Brown
5ef82b53f6
Fix #3137 - support nested templates in class definitions
2020-04-17 01:16:15 -04:00
Brown
35d376cbe7
Fix #3164 - allow nested templates in conditional classes
2020-04-17 00:46:27 -04:00
Brown
15df39f72f
Fix #3127 - allow templated param to be accepted where static is expected
2020-04-12 20:09:49 -04:00
Brown
672baea6fc
Fix #3116 - allow class to be compared to a templated class-string
2020-04-10 00:26:11 -04:00
Brown
a117c48bb2
Add back nuance to error messages for conflicting type bounds
2020-04-08 12:37:46 -04:00
Brown
5db9f0e8c0
Fix #2722 - change behaviour to inherit params to match just on position
...
And not name + position
2020-04-08 00:54:17 -04:00
Brown
067104e170
Fix #3084 - keep track of upper and lower bounds of inferred template types
2020-04-07 00:13:56 -04:00
Brown
387bc02e71
Fix #3082 - merge intersection types when replacing template types
2020-04-06 10:19:36 -04:00
Brown
aca84e6f96
Fix inconsistency in partial template matching
2020-04-05 18:40:25 -04:00
Matthew Brown
d1270a61c7
Suppress MixedAssignment again
2020-04-05 01:04:52 -04:00
Brown
1bf1a6e46b
Accept partial match of template type
2020-04-04 17:14:33 -04:00
Brown
0db49e38f0
Covariant can accept anything
2020-04-04 12:05:01 -04:00
Brown
1b01d7b356
Fix tests
2020-04-04 11:51:24 -04:00
Brown
b73b75f1a1
Allow newlines in shortcut version of return type provider
2020-04-04 11:04:00 -04:00
Brown
56cc5fb611
Allow shortcut for specifying conditional template types
2020-04-04 09:31:12 -04:00
Brown
8f8cc6aed5
Move conditional return type tests
2020-04-04 09:27:11 -04:00
Brown
c0e573ab6a
Try harder to understand templated array_map callable array
...
Fixes #3039
2020-04-03 16:53:56 -04:00
Brown
fa28d767fc
Prevent a templated type from hitting covariance checks
2020-04-01 10:53:40 -04:00
Matthew Brown
de6aee32d1
Fix #3035 - improve templating for property assignments
2020-03-28 17:18:21 -04:00
Brown
056f4aaac6
Fix #3027 - inherited properties should be templated properly
2020-03-27 18:31:48 -04:00
Matthew Brown
f94ab22a5f
Be better about strict inference
2020-03-25 09:18:49 -04:00
Matthew Brown
4734583444
Don’t overwrite already-defined template
2020-03-24 23:40:01 -04:00
iggyvolz
94b246b987
Initial commit ( #3013 )
2020-03-24 18:32:57 -04:00
Brown
f6759c3d16
Check return statement types for inherited docblocks
2020-03-24 17:59:48 -04:00
Brown
cae15b6c62
Use appropriate template types when applying array_filter asssertions
...
Fixes #3008
2020-03-24 12:15:56 -04:00
Matthew Brown
f7907eb43f
Fix #2987 - ignore MixedReturnTypeCoercion for generator send param
2020-03-18 21:25:25 -04:00
Matthew Brown
311bd19a6a
Fix #2983 - inherited lists should have their template types localised
2020-03-18 16:23:09 -04:00
Matthew Brown
50eb12e562
Fix implementation kink
2020-03-15 16:14:09 -04:00
Matthew Brown
532ce576cc
Fix #2974 - interpret interfaces a little better
2020-03-15 15:49:13 -04:00
Matthew Brown
0af2eba4b9
Fix #2973 - don’t allow template type through
2020-03-15 11:14:06 -04:00
Matthew Brown
520db22929
We can infer this type now
2020-03-11 15:43:44 -04:00
Matthew Brown
1062591eec
Fix broken test
2020-03-11 13:44:08 -04:00
Brown
a0da7356e9
Fix #2935 - make handling of templated properties much less hacky
2020-03-09 09:59:02 -04:00
Matthew Brown
8926f1d050
Remove dupe test
2020-03-06 19:37:21 -05:00
Matthew Brown
b999037263
Fix #2928 - properly expand out skipped template inheritance
2020-03-06 19:24:47 -05:00
Brown
09137b0a32
Fix #2918 - fix contradiction issue with templated equality
2020-03-05 16:21:41 -05:00
Matthew Brown
f44c3488eb
Keep track of which arg a given template was assigned from
...
Fixes #2900 - We only care about the depth of a templated match when templating from a particular argument. The next argument should essentially start afresh
2020-03-01 12:27:18 -05:00
Matthew Brown
e0d555e203
Allow function names to passed in as strings for callable template resolution
2020-02-29 15:43:45 -05:00
Matthew Brown
abb3800d20
Fix bad template replacement
2020-02-27 23:00:40 -05:00
Matthew Brown
1f19aed31b
Fix support for replacing mocked types in own classes
2020-02-27 21:36:03 -05:00
Brown
35c1670602
Fix #2875 - treat intersections more similarly than before
2020-02-27 18:42:15 -05:00
Matthew Brown
746f8d4973
Prevent returning named object where template return assumed
2020-02-24 23:14:16 -05:00
Brown
712806b452
Fix #2874 - understand doubly-inherited interface templates
2020-02-24 17:58:44 -05:00
Matthew Brown
4707b21227
Fix tests
2020-02-21 22:15:25 -05:00
Brown
f4485cc529
Fix #2847 - use fully-qualified function name
2020-02-21 16:44:31 -05:00
Brown
b51863fc9b
Fix #2848 - allow casting templated types
2020-02-21 15:17:35 -05:00
Brown
f44a0f9f4c
Fix #2849 - allow object-like templated array comparison
2020-02-21 15:13:07 -05:00
Matthew Brown
9bdca3c706
Forbid array<mixed, ...>
2020-02-21 01:26:51 -05:00
Matthew Brown
00afcda5e0
Fix #2824 - allow unpacking of non-arrays with template params
2020-02-17 19:54:11 -05:00
Matthew Brown
d3bfb96431
Fix #2808 - improve yield type discernment
2020-02-15 10:47:07 -05:00
Matthew Brown
fb5a0c39cb
Fix #2819 - improve negated assertions on templates
2020-02-14 11:18:47 -05:00
Matthew Brown
47ffb59241
Fix #2764 - iterate through all possible template types where necessary
2020-02-09 18:11:50 -05:00
Matthew Brown
b439a573ce
Empty is also the bottom type
2020-02-08 11:40:22 -05:00
Matthew Brown
b26deb434d
Fix #2771 - replace empty params with generic equivalents
...
Ref #2755
2020-02-08 11:17:24 -05:00
Brown
23f8967fb5
Fix conditional class-string template replacement
2020-02-06 19:40:18 -05:00
Brown
d5f71bf529
Localise template checks to class being tested
2020-02-06 16:38:45 -05:00
Brown
0fd0d01d2b
Improve class-string templating
2020-02-06 14:35:36 -05:00
Brown
a16e03d992
Fix #2756 - narrow assertion templated type
2020-02-06 11:49:15 -05:00
Brown
50fc50fab0
Fix #2751 - allow static methods to inherit class templates
2020-02-05 11:19:40 -05:00
Matthew Brown
43c7b00cd0
Fix #2734 - allow is_a to operate on templated class-strings
2020-02-02 12:26:28 -05:00
Matthew Brown
8db4bc7691
Improve formatting of intersection error messages
...
Also reduce false positives on intersections of templates
2020-02-02 12:25:24 -05:00