1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00
Commit Graph

4 Commits

Author SHA1 Message Date
AndrolGenhald
843305c8e0
Support template property invariance (fixes #5371) (#5414)
* Support property invariance with templates.

* Fix false positive NonInvariantDocblockPropertyType with grandchild.

* Redo templated property invariance check to fix issues.

* Add template covariant test.

* Fix property invariance false positive with template-covariant.
2021-03-19 21:55:50 -04:00
AndrolGenhald
d4590711d6
Fix object-like array keys when combining string and automatic keys (fixes #5427). (#5428)
* Fix object-like array keys (fixes #5427).

* Fix incorrect return types for tests.

* Fix false positive list with literal int key.
2021-03-19 21:44:44 -04:00
AndrolGenhald
9d840ee87b
Disable property invariance checks for properties with templates (#5380)
* Disable property invariance checks for templates

Property invariance checks were already disabled for template
properties, this also disabled the checks for arrays, lists,
class-string-maps, and iterables that contain templates.

Partially fixes #5371

* CS fixes

* Fix and simplify hasTemplate.

Add hasTemplate to TypeNode and simplify implementation with getChildNodes.

* Revert hasTemplate change and add containsTemplate.

* Check class-string too.
2021-03-16 13:43:30 -04:00
Matt Brown
4d76f7545c Allow property type invariance on templated properties
This is a bit of a hack – the comparison should be similar to the ones done in MethodComparator, but this avoids false-positives for now
2021-02-07 01:45:48 -05:00