1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-04 02:27:59 +01:00
Commit Graph

5951 Commits

Author SHA1 Message Date
orklah
3bc8cde539
Merge pull request #10488 from kkmuffme/invalidargument-false-not-true-param
add InvalidArgument error when passing false to true param
2023-12-13 18:48:51 +01:00
kkmuffme
d04694f4d4 Fix https://github.com/vimeo/psalm/issues/9267 2023-12-13 15:30:43 +01:00
kkmuffme
cceb1fb8c4 add missing phpdoc in new tests 2023-12-13 15:21:46 +01:00
kkmuffme
af3978281e remove previously broken test https://github.com/vimeo/psalm/issues/10487 2023-12-13 15:05:48 +01:00
kkmuffme
e6f24d91fd Fix https://psalm.dev/r/aada187f50 where 2 union types are not intersected and the condition contains both types 2023-12-13 14:10:22 +01:00
kkmuffme
108f626712 fix literal int/string comparisons only using one literal
Fix https://github.com/vimeo/psalm/issues/9552
2023-12-13 13:59:26 +01:00
kkmuffme
9be7fceb59 Fix literal string keys int not handled as int as PHP does
Fix https://github.com/vimeo/psalm/issues/8680
See also https://github.com/vimeo/psalm/issues/9295
2023-12-13 00:24:50 +01:00
kkmuffme
82ff582280 add error for invalid array key type in docblock 2023-12-13 00:23:14 +01:00
orklah
1df5b3580b
Merge pull request #10454 from kkmuffme/unsealed-not-nonempty-callable-param-should-be-valid
fix false positive ArgumentTypeCoercion for callback param
2023-12-12 21:26:24 +01:00
kkmuffme
3c045b30a7 fix false positive ArgumentTypeCoercion for callback param when unsealed and all optional 2023-12-12 14:13:32 +01:00
kkmuffme
20ae081ee1 fix psalm v4 hardcoded in tests 2023-12-12 07:51:21 +01:00
kkmuffme
5fccb33938 dont combine empty string with numeric-string
Fix https://github.com/vimeo/psalm/issues/6646
2023-12-07 20:05:16 +01:00
orklah
f4e9837e27
Merge pull request #10450 from nicelocal/fix_class_string_key
Fix shaped array class string key combination
2023-12-07 17:52:15 +01:00
576ecd66e6 Fix #10460 2023-12-07 17:29:22 +01:00
0d3485b588 Commit just first part of fix for now 2023-12-07 13:04:59 +01:00
76458e0b50 Add test 2023-12-06 14:52:54 +01:00
4ed0fe934f Fix shaped array class string key combination 2023-12-06 14:12:19 +01:00
390df68966
Merge branch '5.x' into fix_literal_union_key 2023-12-03 20:55:05 +01:00
37cf82ea52
Merge branch '5.x' into fix_literal_union_key 2023-12-03 20:50:05 +01:00
75633cbc6d Merge remote-tracking branch 'hub/5.x' into byref_closure_use 2023-12-03 20:47:51 +01:00
18a6c0b6e9 Implement by-ref closure use analysis 2023-12-03 15:28:51 +01:00
b03b846682 Emit UnusedPsalmSuppress issues for suppressed issues already removed by plugins 2023-12-03 11:45:17 +01:00
orklah
0659967d05
Merge pull request #10429 from tscni/fix/trait-call-static
Fix static magic method pureness not being inherited from traits
2023-12-02 14:30:49 +01:00
0aeb87c21c Simplify 2023-12-01 17:57:50 +01:00
17bf9a45a6 Fixup 2023-12-01 17:46:24 +01:00
147129345e Add failing test 2023-12-01 17:23:35 +01:00
ead2908464 Fixup tests 2023-12-01 17:05:23 +01:00
f652cf09d8 Merge branch 'fix_array_key_exists_negation' into fix_literal_union_key 2023-12-01 16:31:24 +01:00
1a4656564a Cleanup 2023-12-01 16:31:01 +01:00
ab3a17b7b0 Fix 2023-12-01 16:11:14 +01:00
2e249ab3fa Create keyed arrays when assigning literal union keys 2023-12-01 16:03:08 +01:00
ef169893aa cs-fix 2023-12-01 15:07:55 +01:00
cab7cf0330 Fix 2023-12-01 15:03:24 +01:00
edf2d1e4b6 Fix 2023-12-01 15:03:17 +01:00
7e948419cd Fix array_key_exists negation 2023-12-01 13:37:28 +01:00
Tinjo Schöni
4f458b46bc
Fix static magic method pureness not being inherited from traits
https://github.com/vimeo/psalm/pull/10385 "broke" this by propagating pseudo static methods from traits to using classes.
`AtomicStaticCallAnalyzer` was then not capable of dealing with this, because now these static pseudo methods actually exist.

As long as the methods from traits aren't actually transferred to the using class, it seems right that the logic in `AtomicStaticCallAnalyzer` uses `::getDeclaringMethodId()` instead of `::getAppearingMethodId()` for this purpose.
2023-11-29 23:22:14 +01:00
Tinjo Schöni
d91aab15be
Restore support for null coalesce on match expressions
https://github.com/vimeo/psalm/pull/10068 added isset restrictions that didn't consider null coalesces on match expressions.
This restores that support by converting the match expression to a virtual variable for the isset analysis, similar to other incompatible expressions.
2023-11-29 02:08:23 +01:00
73a340fde8 Cleanup 2023-11-26 19:46:45 +01:00
35f194e9e8 Fix backtick analysis 2023-11-26 13:12:11 +01:00
orklah
579cc084cc
Merge pull request #10370 from kkmuffme/fix-misc-callable-bugs
Fix misc callable bugs
2023-11-22 21:19:56 +01:00
kkmuffme
0d7c5a2d8e Fix docblock mixed escape hatch
revert https://github.com/vimeo/psalm/pull/7663 including previous from_docblock Mixed assignments, as the tests required 2 suppressions and created an escape hatch via mixed on higher psalm error levels, where mixed isn't reported, thus hiding potentially fatal bugs.
It's still possible to run the validation of docblock docs though: a @var declaration that contains both possible types, to ensure later code won't escape any checks (and no @psalm-suppress needed at all)

This is also a required preparation to fix some isset issues of https://github.com/vimeo/psalm/issues/9759
2023-11-21 13:01:55 +01:00
kkmuffme
d94f7bd553 loose comparisons of int with string shouldn't change change the int to empty-mixed 2023-11-21 13:01:15 +01:00
kkmuffme
fd2f876574 Remove tests for partially stubbed classes introduced in https://github.com/vimeo/psalm/issues/849, as this didn't work correctly and lead to errors not being reported at all in many cases (since the error was reported for the stubs file and therefore suppressed)
With the previous commit "Fix for classes what https://github.com/vimeo/psalm/pull/8503 fixed for functions", the stubs of classes where the actual file is in the analyzed files are ignored completely.
2023-11-18 08:55:20 +01:00
kkmuffme
3299689d99 revert 804087b of https://github.com/vimeo/psalm/issues/10026 2023-11-18 08:55:20 +01:00
kkmuffme
be6028d7d4 Fix potential cache race conditions/cache not deleted with non-lowercase file paths and add missing docs 2023-11-18 08:55:20 +01:00
kkmuffme
adb8677f20 Fix optional args not enforced in callable (fix for non-closure/arrow functions of https://github.com/vimeo/psalm/issues/8438) Fix array callables not treated as callable https://psalm.dev/r/23f3787207 (this is needed to fix the optional args enforcement for array callables too) 2023-11-18 08:55:20 +01:00
kkmuffme
0ca2d4f597 Fix https://github.com/vimeo/psalm/issues/6085 2023-11-18 08:55:20 +01:00
kkmuffme
5eacd301e9 Fixed ReturnTypeWillChange false positive https://psalm.dev/r/91c6992bf1 with missing return type signature 2023-11-18 08:55:20 +01:00
kkmuffme
0252bbbd7c Fixed https://psalm.dev/r/7f112fd745 - MethodComparator only reported an error for this if the parent class was user defined (= not in stubs), which is wrong, since this will cause a fatal error when running the code 2023-11-18 08:55:20 +01:00
kkmuffme
c5655c510d Fix param providers for native methods not working Fix array_filter params callable incorrect required params depending on the 3rd argument value (at this commit psalm doesn't report an error, due to https://github.com/vimeo/psalm/issues/8438, which gets fixed by this PR later on though) Fix https://github.com/vimeo/psalm/issues/3047 and further improve types for array_multisort and add errors for invalid params Fix SimpleTypeInferer failing on bitwise operations with constants 2023-11-18 08:55:20 +01:00
kkmuffme
ba79797627 Fix https://github.com/vimeo/psalm/issues/10371 2023-11-18 08:55:20 +01:00
kkmuffme
506fb9c773 Fix https://github.com/vimeo/psalm/issues/8919 2023-11-18 08:55:20 +01:00
kkmuffme
be85cb02b9 remove now invalid test 2023-11-18 08:55:20 +01:00
kkmuffme
f3e9263ea4 Fix array_filter callback type
Fix https://github.com/vimeo/psalm/issues/9068
2023-11-18 08:55:19 +01:00
Ivan Sidorov
e677523843 Fixing a collisions on annotations with mixins 2023-11-17 15:50:34 +00:00
Ivan Sidorov
8bb68e9b3f Find properties and methods annotated by mixin 2023-11-17 15:50:34 +00:00
Ivan Sidorov
0c4b8a3c49 Find annotated magic static methods on traits 2023-11-17 15:50:34 +00:00
Ivan Sidorov
ceba3d889d Find annotated magic static methods on parent class 2023-11-17 15:50:34 +00:00
Ivan Sidorov
75394c5037 Find declared methods on parent classes and traits
Partial revert commit 2f039f9072
2023-11-17 15:50:26 +00:00
Ivan Sidorov
d533bb8c2e Ignore annotated magic static methods with usage object gap
Magic methods annotated by methods `__call` and `__callStatic`.
Magic static methods implemented in `__callStatic`
are not required implementation in `__call'.
2023-11-17 15:14:56 +00:00
Ivan Sidorov
715f6f51e1 Ignore annotated magic properties with usage static gap
In PHP is not exists methods for implementation magic static properties.
So, these magic static properties must not be presented.
2023-11-17 15:14:56 +00:00
Ivan Sidorov
1cfc343c43 Ignore declared static properties with usage object gap
Usage static properties in PHP is allow only by static gap.
2023-11-17 15:14:56 +00:00
Ivan Sidorov
6f19440b02 Fix text-labels with type of property
The labels for magic and declared properties must be equal.
2023-11-17 15:14:56 +00:00
Ivan Sidorov
650b8fcd1b Tests of current behaviors in the auto-completion feature 2023-11-17 15:14:56 +00:00
kkmuffme
b0adeb463d fix test 2023-11-13 20:37:48 +01:00
kkmuffme
88e3cda3b9 remove unused function, fix unusedVariable error after suppress 2023-11-13 20:24:58 +01:00
kkmuffme
6a0a9d1c15 fix failing test caused by psalm-suppress as this should be invalidCodeParse test 2023-11-13 19:08:04 +01:00
kkmuffme
dcd53cadab Suppressing NoValue should not treat subsequent code as unevaluated
Fix https://github.com/vimeo/psalm/issues/10302
2023-11-13 18:57:41 +01:00
Ivan Sidorov
2f039f9072 Fix auto-completion with declared static method by DocBlock 2023-10-27 09:35:30 +00:00
Ivan Sidorov
d6faff2844 Fix auto comletion by partial property or method 2023-10-26 21:31:47 +00:00
Daniel Linjama
a375f441f2 fix @param-out with named arguments 2023-10-23 10:39:09 +03:00
3b66272aa0 More rector fixes 2023-10-21 20:45:09 +02:00
576e4d2bc4 Fix method calls and property accesses after extension_loaded 2023-10-19 11:16:20 +02:00
orklah
5a862784ac
Merge pull request #10289 from ging-dev/add-fix
Additional caching fixes
2023-10-17 20:32:03 +02:00
robchett
e2d1e83b87 Fix memory explosion with calls to method_exists 2023-10-17 19:15:23 +01:00
ging-dev
8ee875086f chore: add failing test 2023-10-17 20:17:15 +07:00
ging-dev
0162e75ee8 fix: #10080 2023-10-17 02:43:22 +07:00
orklah
b432d812fb
Merge pull request #10274 from tuqqu/enum-case-value-type-from-class-constant
Fix inferring enum case value from a class constant
2023-10-16 20:25:11 +02:00
orklah
7a7d6a25af
Merge pull request #10242 from cgocast/5.x
Allow tainted numerics except for 'html' and 'has_quotes'
2023-10-16 20:17:39 +02:00
tuqqu
6039e2be9b Fix for inferring enum case value from a class constant 2023-10-10 22:56:36 +02:00
orklah
ee4e8aa720
Merge pull request #10271 from klimick/type-check-nested-templates
Type check nested templates
2023-10-09 19:47:15 +02:00
orklah
3f7306d8df
Merge pull request #10254 from tuqqu/never-function-return-error-message
Fix error message for implicitly returning functions with `never` return type
2023-10-09 18:51:11 +02:00
klimick
a3df6505f0 Type check nested templates 2023-10-09 17:07:52 +03:00
cgocast
eea7c33309
Merge branch 'vimeo:5.x' into 5.x 2023-10-09 14:17:50 +02:00
tuqqu
a4cebb2cb8 Disallow never type for parameters 2023-10-08 20:47:37 +02:00
orklah
16be90c351
Merge pull request #10262 from robchett/negated_class_exist_convert_class-string_to_string
Negated class_exist check on class-string converts to string instead of mixed
2023-10-08 19:09:14 +02:00
orklah
67ac81e220
Merge pull request #10261 from robchett/allow_named_params_for_callables
Allow parameter names in callable docblocks with templates
2023-10-08 19:08:23 +02:00
robchett
d874aab881 Add alias support to psalm-check-type 2023-10-08 17:46:59 +01:00
robchett
c729fcd5c8 Negated class_exist check on class-string converts to string instead of mixed 2023-10-08 15:48:48 +01:00
robchett
fc7f846fbd Fix test case for named variadic callable docblock 2023-10-07 16:59:43 +01:00
robchett
c71a252dee Add tests for callable docblock parsing 2023-10-07 16:04:48 +01:00
tuqqu
2bc330976f Add tests for never return type 2023-10-04 21:18:59 +02:00
tuqqu
9f9e5f1e18 Emit MethodSignatureMismatch when descendant does not return by reference 2023-10-03 03:41:11 +02:00
cgocast
2eca720e9d Merge branch '5.x' of https://github.com/cgocast/psalm into 5.x 2023-10-02 15:13:07 +02:00
cgocast
94a98ccddd Allow tainted numerics except for 'html' and 'has_quotes' 2023-10-02 15:08:26 +02:00
orklah
c67dce7d14
Merge pull request #10240 from ging-dev/cache
fix: #10239
2023-09-30 18:26:59 +02:00
ging-dev
c312c76050 chore: add test 2023-09-30 17:33:50 +07:00
orklah
db07b05156
Merge pull request #10231 from MidnightDesign/sprintf-stringable-values
Allow stringable objects in `sprintf()` values
2023-09-29 11:38:37 +02:00
Rudolph Gottesheim
c4c8ef53c4 Delete an invalid test 2023-09-29 11:27:36 +02:00
orklah
2d3a625379
Merge pull request #10230 from ging-dev/lsp
feat(LSP): Improve the autocomplete for nested array shape
2023-09-28 23:42:02 +02:00