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

4025 Commits

Author SHA1 Message Date
Matt Brown
f6bdeb6234 Fix switch-with-continue bug 2021-05-17 07:27:58 -05:00
orklah
6501ca7b95
Redundant cast to Int preserve type (#5773)
* Redundant cast to Int preserve type

* add test
2021-05-15 07:19:18 -04:00
Matt Brown
1195335078 Fix #5768 - call methods with proper params 2021-05-14 22:50:11 -04:00
orklah
55079e92fe
Mixed contains everything (#5763) 2021-05-14 20:23:54 -04:00
olsavmic
4fb2b65164
Fix ArrayFillReturnTypeProvider - consider second param (#5770)
Add test

Fix
2021-05-14 20:12:39 -04:00
Matt Brown
c4aea7c82c Fix #5434 - prevent crash with class-string-map 2021-05-14 19:44:11 -04:00
orklah
1bb4a05725
NullsafeMethodCall makes the variable not null for the rest of the scope (#5771) 2021-05-14 19:21:01 -04:00
orklah
0b96f40198
quote offset value (#5760) 2021-05-14 17:19:23 -04:00
Matthew Brown
5e8219b613 Fix #5327 - add check to prevent OOMing on very large conditionals 2021-05-14 14:53:53 -04:00
Matthew Brown
18931295c4 Fix #5073 — don’t crash when templates cannot be resolved 2021-05-13 16:55:22 -04:00
Matthew Brown
2ebf97b4cb Fix #4910 - don’t allow array_merge to create massive keyed arrays 2021-05-13 16:27:05 -04:00
Matthew Brown
78ed9404cb Fix #4107 - resolve reference to static in class constant 2021-05-13 12:49:33 -04:00
Matthew Brown
cc7ff94f7c Prevent crash when method being called does not exist in reflection
Crash seen when running this test in PHP 7.4 because the method does not exist, but the call map includes it in 8.0
2021-05-13 12:40:39 -04:00
Matthew Brown
4873f53f69 Fix issue when two continue/break statements write same variable 2021-05-13 09:39:25 -04:00
orklah
1a59e81808
allow scalar values in return to be accepted, even when the branch has no inferred types (#5749) 2021-05-12 18:47:05 -04:00
orklah
ab1732de66
combining never/empty twice gives never (#5756) 2021-05-12 18:46:37 -04:00
orklah
72022139fa
improve array_splice inference (#5738) 2021-05-10 11:45:52 -04:00
Matthew Brown
859b4a2caa Fix #5725 – don’t transform non-docblock types unnecessarily 2021-05-09 12:03:42 -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
Bruce Weirdan
aa854ae338
Link to SARIF JSON schema (#5718)
Fixes vimeo/psalm#5716
2021-05-05 21:47:36 -04:00
Bruce Weirdan
f5a58adcac
Prefer @psalm-template over @phpstan-template (#5713)
* Prefer `@psalm-template` over `@phpstan-template`

Fixes vimeo/psalm#5590

* Prefer `@psalm` templates for methods as well
2021-05-05 21:47:01 -04:00
Bruce Weirdan
58c8e75db3
Suppress issues emitted by MethodComparator at class level (#5711)
Fixes vimeo/psalm#5698
2021-05-05 21:46:29 -04:00
Bruce Weirdan
9e19653a72
Infer never return type (#5710)
* Allow __toString to return never

Fixes vimeo/psalm#5653

* Push $return_is_exit down

* Produce unique control actions

* Test suggesting `@return never`
2021-05-05 01:22:29 -04:00
Matt Brown
ed43c739e3 Prevent another unsafe template situation, skipping key-of tests for now 2021-05-05 01:06:53 -04:00
Matt Brown
ba90267ea7 Fix bad subtyping rule 2021-05-05 00:42:06 -04:00
Bruce Weirdan
27ea40eda0
Fix notice for certain invalid docblocks (#5709)
Fixes vimeo/psalm#5680
2021-05-03 22:28:17 -04:00
Bruce Weirdan
0189420814
Inherit class-level suppressions when checking methods (#5708)
Fixes vimeo/psalm#5687
May fix vimeo/psalm#3357
2021-05-03 22:26:56 -04:00
Matthew Brown
832a190dd4
Support enums (#5699)
* Add initial enum preparation

* Support cases method

* Ignore bad use error

cc @weirdan

* Fix type
2021-05-03 17:54:09 -04:00
Bruce Weirdan
105c6f3a1c
Remove (and prevent) unused uses (#5704)
* Updates `slevomat/coding-standard`
* Removes unused uses
* Prevents unused uses
* Fixes a number of symbol case mismatches
2021-05-03 17:22:15 -04:00
Matt Brown
d93c30d997 Fix Never test for latest PHP Parser 2021-05-03 16:59:24 -04:00
Matt Brown
eb71506a59 Fix #5697 - don’t consider docblocks when checking for invariant properties 2021-05-02 10:45:55 -04:00
Matt Brown
12844621b4 Fix #5693 - revert fix for #2048
The original fix was just a bit too narrow, and led to this bug
2021-05-01 21:13:42 -04:00
Matt Brown
0f7aaa5405 Fix #5696 - combinations of scalars should remove empty-scalar 2021-05-01 20:13:49 -04:00
Matt Brown
3a87f18b5a Fix #5685 - properly negate complex conditionals 2021-05-01 20:00:01 -04:00
Vincent Langlet
fb5c5a9c59
Fix array<empty, empty> not in array{foo?: mixed}<string, mixed> (#5677)
* Fix array<empty, empty> not in array{foo?: mixed}<string, mixed>

* Add tests
2021-04-30 09:00:49 -04:00
Matt Brown
123a9bc703 Add type-accepts-type unit test 2021-04-27 11:26:27 -04:00
Matt Brown
698adeff07 Rename incorrectly-named test 2021-04-25 18:26:00 -04:00
Matt Brown
4f5c205c57 Improve error message for #5489 2021-04-25 16:02:00 -04:00
Bruce Weirdan
933822e400 Do not consider isset checks on static properties as redundant (#5525)
* Do not consider isset checks on static properties as redundant

Unlike normal properties, static properties do not have a prescribed
initialization sequence, so they can always be uninitialized (or unset).
Thus `isset()` checks on them are never redundant.

Fixes vimeo/psalm#5489

* Fix issue with nullable is_static
2021-04-25 15:53:07 -04:00
Matthew Brown
85a0ef0456
Revert "Do not consider isset checks on static properties as redundant (#5525)" (#5670)
This reverts commit cd002e6a87.
2021-04-25 15:46:13 -04:00
Matt Brown
83f08bc1b8 Fix property tests 2021-04-25 15:22:32 -04:00
Matt Brown
67c5dc3c79 Fix #5517 - don’t let a variable’s by-refness be overwritten by a @var docblock 2021-04-25 15:11:23 -04:00
Matt Brown
7b7354efa3 Fix #5518 - add type for property with variable name 2021-04-25 14:49:43 -04:00
Matt Brown
daa40281df Add slashes 2021-04-25 13:32:58 -04:00
Matt Brown
2fa55d147a Allow parent class to call child protected method 2021-04-25 12:44:53 -04:00
Matt Brown
64fdac33e8 Fix #5641 - types should always be comparable to themselves 2021-04-25 10:45:43 -04:00
Vincent Langlet
39e61ae942
Add support for phpstan import-type and type annotations (#5648)
* Add support for phpstan import-type and type annotations

* Add test

* Fix cs
2021-04-19 22:56:08 -04:00
Matt Brown
642f2f435c Fix #5640 - improve handling of assignments in conditional 2021-04-18 16:16:54 -04:00
Bruce Weirdan
93946d0827
Forbid rejecting named arguments when parent allows them (#5627)
Fixes vimeo/psalm#5622
2021-04-15 06:55:13 -04:00
Matt Brown
012dafad79 Fix #5383 - prevent unsound use of new static for generics 2021-04-10 13:16:19 -04:00