AndrolGenhald
d09e420939
Add @psalm-check-type
and @psalm-check-type-exact
.
...
I initially added these as part of my TryAnalyzer rewrite to allow testing complicated `finally` types like this:
```
$foo = 1;
try {
$foo = 2;
} catch (Exception $_) {
$foo = 3;
} finally {
$bar = $foo;
/** @psalm-check-type-exact $bar = 1|2|3 */;
}
/** @psalm-check-type-exact $bar = 2|3 */;
```
Using the `'assertions'` in tests doesn't work since the type is different inside the `finally`.
I decided to extract the new annotation from the rest of my changes and do a separate pull request since I think others may find it useful, and it should be much easier to review than the entire TryAnalyzer rewrite.
2022-02-17 10:37:13 -06:00
Bruce Weirdan
1ee764894a
Merge pull request #7683 from weirdan/fix-psr4-warnings
2022-02-17 04:00:03 +02: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
Matthew Brown
6af3b502df
Remove unnecessary array assignment
2022-02-16 13:04:23 -05:00
Bruce Weirdan
e47752afb4
Merge pull request #7666 from AndrolGenhald/more-class-const-improvements
...
More class const improvements.
2022-02-16 03:43:37 +02:00
Bruce Weirdan
28c5f9c9d3
Merge pull request #7677 from mmcev106/master
2022-02-15 22:26:56 +02:00
Mark McEver
828b093964
Prevent unnecessary filter_var() warnings on primitive types
2022-02-15 14:13:44 -06:00
AndrolGenhald
cc2334f40d
More class const improvements.
...
Add InvalidClassConstType issue as alternative to LessSpecificClassConstType when type isn't contravariant.
Handle final class consts (#6395 ).
Use double quotes for types in class const issues.
2022-02-13 17:19:25 -06:00
orklah
5aa06ae64e
fix merge issues
2022-02-14 00:12:31 +01:00
orklah
1142c818c2
Merge remote-tracking branch 'upstream/4.x' into upstream-master9
2022-02-14 00:10:28 +01:00
orklah
b796f4558a
Merge pull request #7665 from orklah/matchcount
...
fix count with match on arrays
2022-02-13 22:49:31 +01:00
orklah
06ce3adba5
Merge pull request #7664 from AndrolGenhald/bugfix/7613-unused-variable-in-try
...
Fix false positive for unused variable in try (fixes #7613 ).
2022-02-13 22:39:47 +01:00
orklah
97a6abd823
don't anonymize call to count to allow assertions on count to be retrieved
2022-02-13 22:38:38 +01:00
AndrolGenhald
fd0ecf2528
Rename variable to be consistent with existing convention.
2022-02-13 15:34:21 -06:00
AndrolGenhald
32c389482c
Fix issue with nested try
block and add more tests.
2022-02-13 15:30:06 -06:00
AndrolGenhald
7b1599d783
Fix false positive for unused variable in try ( fixes #7613 ).
2022-02-13 15:14:59 -06:00
orklah
8a49caccac
Merge pull request #7663 from orklah/never2
...
Consistency for empty reconciliations
2022-02-13 20:01:45 +01:00
orklah
56504b834a
Merge pull request #7662 from orklah/enumAssertions
...
Enum assertions
2022-02-13 20:01:30 +01:00
orklah
093d9b2821
allow use of an empty reconciliation if the type is from docblock
2022-02-13 19:44:12 +01:00
orklah
aaf34d7573
add test
2022-02-13 19:38:45 +01:00
orklah
5f1b796af9
redundant condition
2022-02-13 19:38:44 +01:00
orklah
586c70c8d3
Reconcile IsNotType between EnumCase and NamedObject
2022-02-13 19:38:44 +01:00
orklah
cf25363fa1
empty reconciliation should return never or mixed depending of the source of the type
2022-02-13 19:36:09 +01:00
orklah
59d3d2aa31
Merge pull request #7655 from orklah/enumCollapsing
...
Enum collapsing
2022-02-13 11:01:07 +01:00
orklah
9cc82d55f7
add test
2022-02-13 10:52:22 +01:00
orklah
954884eb48
consistency between TernaryAnalyzer and IfElseAnalyzer
2022-02-13 10:52:22 +01:00
Bruce Weirdan
52ad607c96
Merge pull request #7661 from weirdan/fix-array_fill_keys
2022-02-13 11:05:05 +02:00
Bruce Weirdan
edddc87002
Merge branch '4.x' into upstream-master
2022-02-13 07:14:23 +02:00
Bruce Weirdan
4ee8a80a17
Use array_fill_keys
...
There was a number of calls to `array_map(fn()=>true, array_flip($array))` that got replaced with a simpler (and more performant) `array_fill_keys($array, true)`
2022-02-13 07:09:28 +02:00
Bruce Weirdan
7f304be4fb
Merge pull request #7659 from chloekek/ErrorException-__construct-line-parameter-name
2022-02-13 05:41:51 +02:00
Bruce Weirdan
915f80ad5f
Merge pull request #7660 from morozov/mysqli-connect-error
2022-02-13 05:14:32 +02:00
Sergei Morozov
946268e4fe
Update return type for mysqli::connect_error
2022-02-12 19:08:09 -08:00
Chloé Kekoa
092f729e46
Correct name of ErrorException::__construct $line param
2022-02-13 01:19:33 +01:00
Bruce Weirdan
293937fbc2
Merge pull request #7657 from weirdan/fix-7610
2022-02-13 01:32:21 +02:00
Bruce Weirdan
dc776d3ada
Suppress false-positive
2022-02-13 00:48:58 +02:00
Bruce Weirdan
45a19b3f3c
Honour global function suppressions for UndefinedFunction
...
Fixes vimeo/psalm#7610
2022-02-13 00:22:55 +02:00
orklah
60feb5fd71
allow collapsing enum cases under named object in combiner
2022-02-12 20:31:39 +01:00
orklah
f7779f85b7
Merge pull request #7652 from sasezaki/remove_scrutinizer
...
Removed .scrutinizer.yml
2022-02-12 12:04:04 +01:00
sasezaki
0fc586c2b9
Removed .scrutinizer.yml
2022-02-12 18:53:54 +09:00
orklah
1d224cebf7
Merge pull request #7651 from orklah/new
...
remove totallyTyped
2022-02-12 10:29:23 +01:00
orklah
a915ef5853
also remove a from_calculation flag which was scheduled for removal in Psalm 5
2022-02-12 10:19:39 +01:00
orklah
85fca56850
remove totallyTyped
2022-02-12 10:19:14 +01:00
orklah
6355597250
fix CS
2022-02-12 10:05:53 +01:00
orklah
e6d491a4ab
Merge remote-tracking branch 'upstream/master' into upstream-master7
2022-02-12 10:01:08 +01:00
orklah
fac55576ab
Merge remote-tracking branch 'upstream/4.x' into upstream-master7
2022-02-12 09:59:55 +01:00
orklah
a3852b8a55
Merge pull request #7650 from orklah/totallytyped
...
deprecate totallyTyped
2022-02-12 09:56:39 +01:00
orklah
24ae96b373
remove usage of totallyTyped internally
2022-02-12 09:51:06 +01:00
orklah
dbf47b16c3
deprecate totallyTyped
2022-02-12 09:30:37 +01:00
orklah
c13a536386
Merge pull request #7614 from kkmuffme/add-phpredis-stubs
...
add phpredis stubs
2022-02-11 23:15:48 +01:00
orklah
6c2484df25
Merge pull request #7632 from sasezaki/composer-require-check
...
Adjust for composer-require-checker check.
2022-02-11 22:58:18 +01:00