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

571 Commits

Author SHA1 Message Date
0155ad7472 Immutable readonly 3 2022-10-03 15:13:47 +02:00
c2ce7e63da Immutable readonly 1 2022-10-03 11:53:05 +02:00
ef60a0c88c Fix properties-of on generics&intersections 2022-10-03 11:28:01 +02:00
3abd0b961f Immutable Unions 2022-10-03 10:45:36 +02:00
kkmuffme
5c39e66b15 fix tests 2022-09-15 19:38:51 +02:00
Matthew Brown
d957ff2015
Fix mixed type hole when sending Foo<string> to Foo<mixed> (#8481)
* Fix mixed type hole when sending Foo<string> to Foo<mixed>

* Fix ifThisIs test

* Suppress bugs highlighted with fix

* Fix PHPDoc parsing
2022-09-13 13:13:06 -04:00
0220da0b32
Add tests 2022-08-17 13:30:36 +02:00
Teemu Koskinen
89b7b3234b
Add test for #8373
Undefined classes in function dockblocks should not crash psalm.
Test provided by @AndrolGenhald
2022-08-08 23:49:14 +03:00
kkmuffme
d2be169ce5 update tests 2022-08-03 20:12:18 +02:00
someniatko
0c652f72f6 #8330 - take into account that static type may have been unwrapped in ExistingAtomicStaticCallAnalyzer#hasStaticInType() 2022-07-29 12:31:37 +03:00
c409675e3e
Fix intersection of final classes 2022-07-27 18:46:07 +02:00
37274b308f
Add temporary failing test 2022-07-27 17:51:55 +02:00
09fb879428
Fix #8322, #8319 2022-07-27 17:42:48 +02:00
someniatko
1e0b572264 #8200 - bikeshedding the tests 2022-07-14 10:03:47 +03:00
someniatko
21a6dd9096 #8200 - move tests to the correct provider ("valid" instead of "invalid") 2022-07-12 21:53:14 +03:00
someniatko
ecbceb1d58 #8200 - move Issue8200Test to ClassTemplateTest 2022-07-12 21:38:23 +03:00
someniatko
b3e673d7ec #8200 - flip logic of determining "source" of static type in ExistingAtomicStaticCallAnalyzer::getMethodReturnType() 2022-07-12 21:17:10 +03:00
someniatko
3a5054018b #8200 - generalize ExistingAtomicStaticCallAnalyzer::hasStaticInType() for non-object cases 2022-07-12 21:00:19 +03:00
someniatko
470885e4f1 #8200 - improve inferring the "final" static type when calling static methods inside a different class
differentiate between `static` defined in a class which CALLS a given static method, and `static` defined in the method which IS CALLED.
2022-07-12 13:51:28 +03:00
AndrolGenhald
285740a753 Merge branch '4.x' 2022-07-07 15:01:38 -05:00
4bd5ca7e6f
Fix 2022-06-28 15:46:30 +02:00
367b311021
Fix namespace of test 2022-06-28 15:42:32 +02:00
AndrolGenhald
271dce8b6c Fix test format after cherry-pick from master. 2022-06-07 19:16:53 -05:00
AndrolGenhald
af5c191e7b Fix generic object comparison to use template constraint as default (fixes #8068). 2022-06-07 19:12:36 -05:00
Bruce Weirdan
e0acf22e40
Merge branch '4.x' into update-master 2022-05-28 14:49:12 -04:00
Matt Brown
fccc366c1e Merge pull request #7887 from ging-dev/lsp-fixes
improve LSP
2022-04-27 10:13:17 -04:00
Matt Brown
d064d9fc6c Add test 2022-04-27 01:47:02 -04:00
hirokinoue
a525342bc7 add test case 2022-04-16 14:05:51 +09:00
Vincent Langlet
48bc030eec Add test 2022-04-09 21:59:23 +02:00
Patrick Remy
be49037d70
feat: add template support to properties-of<T> 2022-02-23 21:30:09 +01:00
Bruce Weirdan
e517295f7e
Fixed PSR-4 warnings
Fixes the following warnings that were emitted by `composer install`:

```
Generating optimized autoload files
Class Psalm\Tests\KeyOfTemplateTest located in ./tests/Template/KeyOfTemplateTest.php does not comply with psr-4 autoloading standard. Skipping.
Class Psalm\Tests\ValueOfTemplateTest located in ./tests/Template/ValueOfTemplateTest.php does not comply with psr-4 autoloading standard. Skipping.
```
2022-02-17 03:52:07 +02:00
orklah
2e01e9b7cd
Merge pull request #7396 from Patrick-Remy/feat/key-of-value-of-improvements
feat: make key-of/value-of usable with non-const arrays
2022-01-31 21:39:01 +01:00
Patrick Remy
51d4bf556a
fix: replace template args in key-of/value-of
Extend TTemplateKeyOf from Atomic instead of Scalar, to ensure it is
only compared in AtomicTypeComparator to reduce duplicate code.
2022-01-31 20:53:36 +01:00
8d0c1c62e8
Ensure all template parameters are specified in classes, interfaces, traits 2022-01-31 10:06:31 +01:00
orklah
1220320e0b
fix some iterator stubs (#6970)
* fix some iterator stubs

* fix iterators

* update stubs

* fix a test

* fixes

* fixes

* fix a test

* fix
2022-01-30 01:18:05 +01:00
Patrick Remy
51cab704c4
fix: key-of/value-of handle nested template params 2022-01-28 00:04:21 +01:00
Patrick Remy
f87e429e58
fix: infer key-of/value-of type if still templated
Not in all cases the TemplateParam gets replaced before type checking,
in these cases, use the defined `as` type.
Refactor to extract key/value type of array union to method.
2022-01-27 22:39:50 +01:00
Patrick Remy
8cd5ccd076
feat: make value-of<T> capable for template types 2022-01-27 22:28:40 +01:00
Patrick Remy
ed87465f71
tests: correct 'SKIPPED' prefix for skipped test 2022-01-27 22:28:40 +01:00
Patrick Remy
1f28d025c3
feat: allow unions for key-of/value-of
Add tests for TValueOfArray.
2022-01-27 22:28:24 +01:00
Patrick Remy
2880d046ce
feat: make key-of/value-of usable with non-const arrays 2022-01-27 22:22:14 +01:00
orklah
7c8441baec
Merge pull request #7123 from AndrolGenhald/feature/942-type-annotate-class-constants
Support type annotations for class consts (fixes #942).
2022-01-25 20:54:40 +01:00
Matthew Brown
61d450a267 Fix combination of templated types 2022-01-24 13:56:32 -05:00
Matthew Brown
944b281cbe Prevent negation from removing unmatched template vars 2022-01-24 13:20:02 -05:00
orklah
a7b72b865f remove TPositiveInt usage for TIntRange 2022-01-23 22:04:18 +01:00
AndrolGenhald
c18a155f77 Support type annotations for class consts (fixes #942). 2022-01-22 17:06:53 -06:00
orklah
0e891f25ad refactor description of types in Atomic 2022-01-22 19:34:57 +01:00
orklah
d1a946c221
Merge pull request #7454 from petewalker/feat/native-intersections
feat: Handle native intersection types
2022-01-22 11:18:54 +01:00
Pete Walker
057a99c9f1
fix: Tests / minor bug 2022-01-22 00:00:45 +00:00
orklah
fe9d3f02a8 nitpicks 2022-01-20 23:47:41 +01:00
Matthew Brown
0a81f8cd6c
Use objects, not strings, for assertions (#7410)
* Use objects, not strings, for assertions

* Remove unnecessary param

* Remove some unnecessary checks

* Fix bad find/replace

* Add note about assertions no longer stored as strings in UPGRADING.md
2022-01-20 17:33:06 -05:00
Matthew Brown
91902943bd Make test more of a real-world example 2022-01-16 10:19:51 -05:00
orklah
e8c8161dd6 fix merge induced errors 2022-01-15 20:32:09 +01:00
orklah
5b82082bbd Merge remote-tracking branch 'upstream/4.x' into upstream-master2 2022-01-15 20:21:00 +01:00
Matthew Brown
b49682a485 Simplify issue suppression in tests 2022-01-13 14:38:17 -05:00
Matthew Brown
f439d6550b
Ensure that all entries in test arrays have explicit keys (#7386)
* Transformation that updates assertions

* Simplify transformation

* Ensure that all tests have keys

* Fix a few remaining keys
2022-01-13 13:49:37 -05:00
Vincent
fe7665aaaf Add support of template for docblock methods (fix #7320) 2022-01-13 11:04:37 +01:00
Matthew Brown
4abbd9cb1b Simplify object comparison 2022-01-07 18:50:13 -05:00
Bruce Weirdan
ab60d311c2
Merge pull request #7188 from vimeo/muglug-use-invalidscalarargument-less 2022-01-03 06:04:42 +02:00
orklah
0747b48d06
remove TEmpty 2022-01-03 04:09:59 +02:00
Matthew Brown
b419c299e3
Use InvalidScalarArgument only when we can be sure PHP attempts coercion 2022-01-02 14:56:18 +02:00
Bruce Weirdan
36d5a2a83c
Merge pull request #7019 from zoonru/no_ksort_list 2022-01-02 07:37:21 +02:00
orklah
8e5c9f02bb fix test 2022-01-01 11:21:43 +01:00
ff7abec2bd
Fix tests 2021-12-30 12:01:25 +01:00
rarila
97e6511fab Set number of lines before and after namespace. 2021-12-15 04:58:32 +01:00
adrew
dee3fc4358 try to fix generic assertions for list and array 2021-12-06 02:25:40 +03:00
ralila
8fb2e0f885 Handle some partials 2021-12-04 21:55:53 +01:00
04bbd2acba
Fix tests 2021-11-26 21:47:17 +01:00
Alexey Borzov
136624e817 Add another check to a PHP_VERSION_ID condition test 2021-10-30 01:13:28 +03:00
Alexey Borzov
91ec5712ad Add a means to switch return types based on PHP_VERSION_ID
As suggested in vimeo/psalm#6755
2021-10-29 22:19:38 +03:00
02e293bc07
Improve test 2021-10-27 11:02:35 +02:00
9c59550e15
Fully fix recursive template parameter resolution 2021-10-27 10:58:33 +02:00
3f1fef1fce
Fix tests 2021-10-26 13:38:06 +02:00
6fe44b3374
Add tests 2021-10-26 13:26:36 +02:00
orklah
9fb959150a
Merge pull request #6730 from orklah/int-template-arithmetics
don't emit issues when doing arithmetics on int templates
2021-10-24 20:39:54 +02:00
orklah
af918a95a2 don't emit issues when doing arithmetics on int templates 2021-10-24 19:30:39 +02:00
orklah
90d6239d74 strlen of strtolower of string is not always true 2021-10-24 18:40:13 +02:00
orklah
0339815070 fix type leaking when using ternaries 2021-10-23 18:58:05 +02:00
orklah
fb5a652e18 Don't refine empty/falsy assertions on templates inside loops 2021-10-23 11:17:47 +02:00
orklah
8b98e645eb skipped tests 2021-10-20 23:37:52 +02:00
orklah
8b151f39c8 put back one of the errors 2021-10-09 22:09:48 +02:00
orklah
d7dfd87390 remove suppress on an old test 2021-10-09 21:04:06 +02:00
orklah
4866155b3a add test 2021-10-09 20:03:52 +02:00
whsv26
8b54cca3a8 Fix different context templates invalid argument bug for trait. 2021-09-13 23:43:09 +03:00
Matthew Brown
a205a23ccb Fix #6212 - remove untested code, add test for reasonable behaviour 2021-07-31 19:50:56 -04:00
Matthew Brown
88c4e2468e
Support interface-string<Foo> as temporary alias of class-string<Foo> (#6106) 2021-07-16 18:38:39 -04:00
Matthew Brown
acc7ee261c
Fix #6066 - introduce more robust system for capturing template constraints (#6072)
* Fix #6066 - add better system for capturing template constraints

* Fix comment
2021-07-11 12:03:21 -04:00
Matt Brown
f5bc841295 Prevent nested literal coercion 2021-06-09 16:01:45 -04:00
Matthew Brown
d12cf88e83 Add back supported for templated index assignment 2021-06-09 12:55:37 -04:00
Bruce Weirdan
6abce3525a
Enforce use sort (#5900) 2021-06-07 22:55:21 -04:00
Matt Brown
38c452ae58 Add example given in ticket and ensure that works too 2021-05-24 00:09:51 -04:00
Matt Brown
8f333337cb Fix #5804 - don’t choke on conditional return types when converting to callables 2021-05-23 21:41:07 -04:00
Matt Brown
d1262b0bec Fix #5799 — improve expansion of templated types 2021-05-23 14:39:59 -04:00
Matt Brown
964c91c502 Fix skipped test 2021-05-20 10:57:25 -04:00
Matt Brown
3a811f1fb5 Fix/suppress failures 2021-05-19 15:30:36 -04:00
Matt Brown
1195335078 Fix #5768 - call methods with proper params 2021-05-14 22:50:11 -04:00
Matt Brown
c4aea7c82c Fix #5434 - prevent crash with class-string-map 2021-05-14 19:44:11 -04:00
Matthew Brown
18931295c4 Fix #5073 — don’t crash when templates cannot be resolved 2021-05-13 16:55:22 -04:00
Vincent Langlet
587b144f0e
Check for ParamName even for method with only one param (#5732)
* Check for ParamName even for method with only one param

* Fix tests
2021-05-08 19:33:48 -04:00
Matt Brown
ed43c739e3 Prevent another unsafe template situation, skipping key-of tests for now 2021-05-05 01:06:53 -04:00