Antonio del Olmo
d6cf9faebb
Add support for Override attribute
2023-12-15 11:14:53 +01:00
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
orklah
f57088646b
Merge pull request #10191 from boesing/bugfix/inherited-conditional-return-types
...
Resolve inherited conditional return types
2023-09-28 23:08:20 +02:00
orklah
bbcf50396d
Merge pull request #10189 from boesing/feature/inherited-assertions-v2
...
Inherited assertions v2
2023-09-28 23:07:15 +02:00
Rudolph Gottesheim
aa04c0063b
Allow Stringable in sprintf() values
2023-09-28 10:23:02 +02:00
orklah
83485f3fcf
Merge pull request #10234 from tuqqu/block-mode-declare-check
...
Check for declare strict_types in block mode
2023-09-28 09:13:13 +02:00
orklah
a8ef5a213d
Merge pull request #10202 from gmessier/issue-handlers-priority
...
Issue handlers priority
2023-09-28 09:09:33 +02:00
orklah
a843c30950
Merge pull request #10207 from boesing/bugfix/issue-10203
...
Allow object assertions for `mixed` values
2023-09-28 09:08:43 +02:00
tuqqu
09fbe99f5b
Check for declare strict types block mode
2023-09-26 20:59:06 +02:00
ging-dev
45807e27b8
feat(LSP): Improve the autocomplete for nested array shape
2023-09-26 01:52:23 +07:00
Rudolph Gottesheim
3b775f4617
Allow class-string<T> where T is a union
2023-09-18 12:13:34 +02:00
robchett
03e8d19eec
Only the binary op 'plus' works with two arrays
...
Treat the result of any other operation as int|float
Fixes #2123
2023-09-16 15:55:59 +01:00
Maximilian Bösing
3e100b15d9
bugfix: allow object assertions for mixed
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-09-15 20:19:54 +02:00
Guillaume Messier
ae427fd60e
Add 'safe' methods to prevent overriding issueHandlers already defined in the configuration
2023-09-13 16:30:33 -04:00
Maximilian Bösing
eda55a2d27
qa: make assertions more strict as we do want exact matches
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-09-11 11:14:12 +02:00
Maximilian Bösing
3dc00518c6
qa: add test for inherited conditional templated return types
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-09-10 23:57:02 +02:00
Maximilian Bösing
56b719b1e6
qa: remove unnecessary lines from tests
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-09-10 22:17:30 +02:00
Maximilian Bösing
f6f7c20f36
qa: extend inherited assertion test
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-09-10 22:17:29 +02:00
Bruce Weirdan
ea1664f30b
Merge pull request #10190 from boesing/feature/array-object-array-key
2023-09-10 20:09:10 +03:00
Maximilian Bösing
7f8ec79243
qa: modify tests since array keys are not mixed for ArrayObject
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-09-10 16:06:56 +02:00
George Steel
e98ed16577
DateTimeZone::getName()
always returns non-empty-string
and cannot be constructed with an empty string
...
Signed-off-by: George Steel <george@net-glue.co.uk>
2023-09-09 23:48:49 +01:00
Tinjo Schöni
8fbe14a34b
Restore support for namespaced functions in referencedFunction config
2023-09-09 01:47:09 +02:00
Bruce Weirdan
cd8fc46554
Flag invalid declares
2023-09-02 23:41:50 +02:00
robchett
d0c4d170b0
Apply psalm-inheritors to interfaces too
2023-08-31 23:12:10 +02:00
robchett
e23971ca29
InheritorViolation was only being triggered on grand-childen classes
...
Fixes #10167
2023-08-31 23:12:07 +02:00
Bruce Weirdan
3814fbb231
Merge pull request #10157 from boesing/bugfix/assertions-from-inherited-docblock
2023-08-28 12:04:47 +02:00
Bruce Weirdan
b3150d451a
Fix crash on property access to undefined property on a class with a missing dependncy
2023-08-28 01:58:02 +02:00
Maximilian Bösing
5e520e6bff
bugfix: properly inherit assertions from parents or implemented interfaces
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-08-28 01:12:28 +02:00
cgocast
c8b47b17bf
Fix typo
2023-08-26 21:54:26 +02:00
cgocast
72c9bf8575
New sinks for TaintedCallable #10117
2023-08-26 19:29:00 +02:00
Maximilian Bösing
5948559a31
feature: introducing proper handling of value-of
in combination with backed enums
...
This introduces both:
- a bugfix for a regression introduced by `31eaf83c4` which prevents backed enums are incorrectly identified as literals
- an additional feature so that `value-of` can be used with backed enums to assert any of the enum cases values
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-08-25 23:58:53 +02:00
Maximilian Bösing
22bcd576d3
qa: add test to verify backed enums are no literals
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-08-25 23:53:58 +02:00
Bruce Weirdan
1474340cf2
Fix crash on array access to undefined class
2023-08-20 23:45:30 +02:00
Bruce Weirdan
03f7c263fe
Correct type for $enum->name
2023-08-13 05:56:33 +02:00
Kuba Werłos
18a4752970
Add test
2023-08-12 12:28:23 +02:00
Yannick Gottschalk
a4de6d9dc0
Fix #9997
...
- make SimpleXmlElement and SimpleXmlIterator not a universal object crate
- added typed magic __get method to SimpleXmlElement
- adjusted tests to reflect new behaviour of SimpleXmlElement
- added tests
2023-08-05 17:07:08 +02:00
kkmuffme
02385c2b49
code style + update tests
2023-08-04 23:56:47 +02:00
kkmuffme
0a58a68e9a
make (s)printf error reporting more correct/literal
...
Fix https://github.com/vimeo/psalm/issues/10021
Fix https://github.com/vimeo/psalm/issues/9987 again now for all cases (specifically https://github.com/vimeo/psalm/issues/9987#issuecomment-1624360506 )
Use RedundantFunctionCall instead of InvalidArgument, where it's technically valid.
Report TooManyArguments when a format without placeholders is used
Report an error for splat with vprintf/vsprintf
2023-08-04 23:38:48 +02:00
orklah
b9d355e082
Merge pull request #10071 from weirdan/fix-10070
...
Allow method-like strings in `referencedFunction`
2023-08-01 07:16:55 +02:00
Bruce Weirdan
ec842c0f3d
Allow method-like strings in referencedFunction
...
Fixes vimeo/psalm#10070
2023-08-01 06:37:01 +02:00
klimick
809b27c499
Fix variadic callable type check
2023-07-30 11:43:07 +03:00
63347e71ae
Merge remote-tracking branch 'hub/5.x' into non_falsy_string_literal
2023-07-29 15:04:04 +02:00
orklah
73ebe227b2
Merge pull request #10055 from thbley/master
...
Add type detection for PDOStatement::fetchAll(PDO::FETCH_CLASS, SomeClass::class)
2023-07-27 19:03:09 +02:00
Thomas Bley
ee505259aa
#9974 extended test with PDO::ATTR_DEFAULT_FETCH_MODE for future implementation
2023-07-27 15:59:31 +02:00
Thomas Bley
d600705b0c
#9974 removed references_in_scope for setFetchMode
2023-07-27 15:53:05 +02:00
Thomas Bley
66bc28d2a8
#9974 extended return type detection for PDOStatement::fetchAll/fetch with FETCH_COLUMN and FETCH_KEY_PAIR
2023-07-27 01:39:21 +02:00
Bruce Weirdan
6c0a09a36a
Merge pull request #10050 from weirdan/lsp-modernize-progress-reporting
...
Modernize LSP progress reporting
2023-07-27 01:11:36 +02:00
Thomas Bley
fc74ae83e6
#9974 added return type detection for PDOStatement::fetchAll, extended return type detection for PDOStatement::fetch
2023-07-27 00:40:26 +02:00
orklah
be875f50e4
Merge pull request #10028 from thbley/master
...
added GitHub CI for unit tests with PHP 8.2 and 8.3
2023-07-26 19:23:15 +02:00
Bruce Weirdan
4f6fc3585b
Update tests to account for new progress protocol
2023-07-26 05:16:37 +02:00
Bruce Weirdan
0a2a0feaf2
CS fix
2023-07-24 21:59:34 +02:00