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
Matthew Brown
b67f661604
Fix #2735 - interpret template check in context of class-string generation
2020-02-02 10:51:18 -05:00
Matthew Brown
6dbb911da1
Fix templating class-string unions
2020-02-01 15:02:44 -05:00
Brown
216d9256a1
Allow templated array_map callable inference
...
Fixes #2719
2020-01-30 17:13:46 -05:00
Brown
a2e1dfd64e
Fix #2667 - don’t check inherited signature return types for accuracy
2020-01-21 11:07:44 -05:00
Matthew Brown
146dd461ef
Fix #2569 - improve template return type checks
2020-01-07 21:08:13 -05:00
Brown
024ec38aa1
Fix #2567 - still remap params in some circumstances
2020-01-07 13:01:16 -05:00
Matthew Brown
2cd7f74efb
Fix #2554 - treat templated class string as proper subtype of class string
2020-01-07 00:39:16 -05:00
Matthew Brown
137650fe6f
Fix #2556 - don’t remap params if they’ve already been remapped once
2020-01-06 09:18:16 -05:00
Matthew Brown
086d141f5c
Fix #2537 - allow complex intersection templates to be preserved
2020-01-01 13:51:54 -05:00
Matthew Brown
023c4bcef0
Fix #2532 - fix templating inside class method when calling templated method
2019-12-30 07:25:36 -05:00
Matthew Brown
2b88261ecd
Fix templated assertion cc @vasily-kartashov
...
This is a good reason for you to skip 3.8.1
2019-12-29 11:57:54 -05:00
Matthew Brown
d3fb0181cb
Fix #2527 - no crash when template cannot be resolved
2019-12-29 08:45:42 -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
068afa09d3
Add very basic implementation for class-string-map
...
Fixes #1969
2019-12-27 12:49:28 -05:00
Matthew Brown
b78f273ccf
Improve handling of template params a smidge
2019-12-27 11:49:44 -05:00
Matthew Brown
a4191171bf
Fix #2483 - treat intersecting PHPDocs from interfaces better
2019-12-20 01:42:57 +00:00
Matthew Brown
cb797c6159
Fix inherited class methods as well
...
Ref #2478
2019-12-18 14:39:37 +00:00
Matthew Brown
49a3f89526
Fix #2478 - process trait template inheritance sensibly
2019-12-18 13:58:37 +00:00
Matthew Brown
bdbc758ddc
Fix #2475 - allow iterable covariance
2019-12-16 07:16:35 -05:00
Matthew Brown
72f3c306d7
Fix #2471 - don’t erroneously template class-strings
2019-12-15 13:23:04 -05:00
Matthew Brown
ce2e5b27c0
Fix #2470 - only parameterise constructors according to inherited params
2019-12-14 11:38:09 -05:00
Matthew Brown
797a059a84
Prevent static methods using class instance template types
2019-12-14 09:40:09 -05:00
Matthew Brown
b48021dbfd
Allow null return on template with null as type
...
Ref #2466
2019-12-13 21:56:43 -05:00
Matthew Brown
f40b6625eb
Fix #2431 - allow null in template defaults
2019-12-13 21:40:09 -05:00
Matthew Brown
af52590fef
Make test better
2019-12-11 00:42:09 -05:00
Matthew Brown
848cbbb487
Fix #2454 - build up template map to better understand passed-through data
2019-12-11 00:34:54 -05:00
Matthew Brown
8494f02008
Fix template handling when templating inside templated class
2019-12-10 00:50:36 -05:00
Brown
b78acf796f
Fix #2445 - only generalise param when it’s generic
2019-12-09 10:58:09 -05:00
Matthew Brown
517aaac851
Fix #2432 - narrow template type after is_object check
2019-12-08 21:40:15 -05:00
Matthew Brown
d6a731be73
Fix #2441 - add error when @template type is missing
2019-12-08 21:19:29 -05:00
Matthew Brown
e3d108ebd9
Fix #2439 - fix templating of class-string<T>::returnsStatic
2019-12-08 21:12:25 -05:00
Matthew Brown
69e6624b16
Fix #2436 - fix templating of property types inside templated functions
2019-12-08 19:25:40 -05:00
Brown
d5f5c742ce
Fix #2411 - allow use of covariant params in array returned value
2019-12-04 10:49:07 -05:00
Matthew Brown
27c9aa4286
Fix code and test
2019-12-01 10:43:51 -05:00
Matthew Brown
f21150b8ad
Fix #2384 - fix resolution of @param-out template types
2019-12-01 10:40:53 -05:00
Matthew Brown
088228f119
Fix template default type issue
2019-11-30 12:54:08 -05:00
Matthew Brown
04879af105
Be less forgiving when extending builtin generic classes
2019-11-30 09:32:21 -05:00
Matthew Brown
d7c3ce2fa8
Fix test to be more accomodating
2019-11-30 01:28:02 -05:00
Matthew Brown
45bf8eee00
Add test that should always work
2019-11-29 11:25:29 -05:00
Matthew Brown
1e3ecb5fd0
Fix #2387 - ensure docblock return types are checked
2019-11-29 11:20:37 -05:00
Matthew Brown
a4e18f9b5e
Fix #2386 - make generator params invariant
2019-11-29 01:44:31 -05:00
Bruce Weirdan
377e47c8bd
Added WeakReference support ( #2389 )
2019-11-29 01:21:38 -05:00
Brown
532e2d64be
Allow using covariant template in mutation-free context
2019-11-26 11:35:03 -05:00
Brown
a91d2ef572
Add space
2019-11-25 16:55:44 -05:00
Brown
736ccd84cd
Allow more generic iterable when yielding
...
Fixes #2353
2019-11-25 16:12:44 -05:00
Brown
b693b726c7
Improve handling of default extended params
2019-11-14 12:12:09 -05:00
Brown
70b8df268d
Fix template covariance calculation, use container covariance not inputs
2019-11-14 11:43:49 -05:00
Brown
23c37f829d
Move covariant tests into their own place
2019-11-14 11:42:16 -05:00
Matthew Brown
0b1f83ff98
Fix #2346 - map covariance of templated return types when extending with more params
2019-11-14 07:45:20 -05:00
Matthew Brown
7012bedf4e
Fix #2326 - substitute static more responsibly in generic objects
2019-11-12 08:01:22 -05:00
Matthew Brown
b1aae0d1a5
Fix more try/catch stuff
2019-11-12 00:52:10 -05:00
Brown
46d163996e
Fix #2321 - prevent inferred template coercion
2019-11-11 09:14:34 -05:00
Brown
4e5af3490a
Fix #2315 - allow Traversable->iterable templated casting
2019-11-08 13:11:01 -05:00
Brown
ac6256e645
Fix #2312 , improve understanding of template replacement
2019-11-08 11:56:41 -05:00
Brown
3d7b34e7f6
Fix #2273 - ensure all template params are bound
2019-11-07 11:03:41 -05:00
Brown
86b6801066
Fix #2294 - detect invalid callble due to __invoke
2019-11-07 09:39:24 -05:00
Brown
64996f464e
Prevent empty array workaround to #2308
2019-11-06 16:59:08 -05:00
Brown
3e98c800ec
Fix #2309 - prevent closure-inferred generic template params overwriting parent ones
2019-11-06 13:13:02 -05:00
Brown
a8ed6ba9c4
Fix #2308 - prevent specialisation from bound params
2019-11-06 11:20:51 -05:00
Matthew Brown
b81a2d3852
Fix #2306 - allow nullable templated params to be compared to null
2019-11-05 18:37:46 -05:00
Brown
5c8cb37b0f
Fix #2301 - do a naive projection of template params
2019-11-05 12:59:56 -05:00
Brown
4bf632bc23
Only extend covariant flag to vars without template param
2019-11-04 11:12:59 -05:00
Matthew Brown
5faebe2674
Fix templated assertion handling for static methods
2019-11-04 05:31:45 -05:00
Matthew Brown
8f421dc0bb
Refactor template calculation out from Psalm\Type\Union
2019-11-03 21:27:40 -05:00
Matthew Brown
a82e35a59f
Fix #2291 - extended covariant template param types should be treated as covariant
2019-11-01 18:25:07 +01:00
Matthew Brown
6517d0a5f5
Add test
2019-11-01 17:33:54 +01:00
Matthew Brown
bab7e46983
Fix #2281 - allow lists to accept list types
2019-11-01 13:35:16 +00:00
Matthew Brown
4845bbbd49
Improve solution to extended type juggling
2019-10-29 19:30:19 +00:00
Matthew Brown
8d7cdeb8ec
Fix #2275 - allow extended templated types to bypass mixed type coercion rules
2019-10-29 10:07:34 +00:00
Brown
dda68228f3
Fix #2247 - don’t crash when yielding from class with too many template params
2019-10-18 11:01:16 -04:00
lhchavez
216f991b0c
Normalize stringified type names ( #2239 )
...
This change makes stringified types more normalized. Concretely it sorts
all union types, reconciled types, and sorts the keys within object-like
types.
2019-10-17 01:14:33 -04:00
Brown
3f837a3493
Fix #2192 - allow static return value on templated object
2019-10-11 12:02:41 -04:00