Bruce Weirdan
c40f232d31
Merge pull request #10629 from edsrzf/analyze-dynamic-fetches
2024-02-05 07:16:03 -04:00
Evan Shaw
a827806709
ParseError for dynamic constants before PHP 8.3
2024-02-05 21:49:40 +13:00
Bruce Weirdan
b2a2cd7884
Allow adding Closure
as a native property type
2024-02-04 19:20:54 +01:00
Bruce Weirdan
e8b47f7d42
Do not add callable
as a native property type
...
It's invalid in all PHP versions: https://3v4l.org/bXWo2
Also see php.net/manual/en/language.types.declarations.php#language.types.declarations.base.function
Fixes vimeo/psalm#10650
2024-02-04 18:52:20 +01:00
Evan Shaw
ea9cb44699
Emit InvalidOverride
2024-02-04 09:01:30 +13:00
robchett
9d4fd4011d
Support user defined types for psalm-check-type
2024-02-03 18:26:20 +00:00
robchett
526013e77e
Fix check-type when using reserved types from within a namespace
2024-02-03 18:09:23 +00:00
robchett
421cb0f7a1
Allow enum cases to be global constants
2024-02-01 18:38:46 +01:00
Evan Shaw
88c2e00d02
Analyze dynamic class const names
2024-02-01 17:40:25 +13:00
Evan Shaw
a66aace523
Analyze dynamic static property names
2024-02-01 17:31:15 +13:00
Bruce Weirdan
6140f6881c
Allow typedef imports from any classlike type
...
All we really need is for the source to be autoloadable, and it includes
all classlikes (interfaces, classes, enums and traits at the time of
writing).
2024-01-31 23:07:23 +01:00
Bruce Weirdan
04ba9358e3
Merge pull request #10605 from edsrzf/php-parser-tweaks
2024-01-30 18:52:27 -04:00
Bruce Weirdan
ca9a12ddda
Report MissingConstructor
for natively typed mixed properties
...
Fixes vimeo/psalm#10589
2024-01-30 17:24:27 +01:00
Bruce Weirdan
f045730927
Merge pull request #10598 from weirdan/key_exists-is-an-alias-for-array_key_exists
2024-01-29 16:23:35 -04:00
Bruce Weirdan
fd1294eef4
Merge pull request #10599 from weirdan/allow-properties-on-intersections-with-enum-interfaces
2024-01-29 16:23:20 -04:00
Bruce Weirdan
872cf58236
Merge pull request #10601 from weirdan/do-not-validate-callable-arguments-in-lenient-contexts
2024-01-29 16:22:47 -04:00
Evan Shaw
98d98be443
Re-work CheckTrivialExprVisitor
...
In php-parser 5.0, `ClosureUse` is no longer considered an expression.
This requires changes to Psalm's `CheckTrivialExprVisitor`, which stores
an array of "non-trivial" `Expr` nodes.
However the only use of this array is to count whether or not it's
empty. Instead of keeping the array, we can keep a boolean, and avoid
needing to change the types in this class when we upgrade to php-parser
5.0.
2024-01-29 13:25:25 +13:00
Evan Shaw
361ba65af0
Use flags key instead of type for ClassMethod
2024-01-28 14:12:26 +13:00
Bruce Weirdan
67a91e05b2
Do not validate callable arguments in lenient contexts
...
Fixes vimeo/psalm#10453
2024-01-27 16:38:37 +01:00
Bruce Weirdan
c1e22ddcaa
Allow properties on intersections with enum interfaces
...
Fixes vimeo/psalm#10585
2024-01-27 14:37:26 +01:00
Bruce Weirdan
6e2effaf9a
key_exists()
is an alias for array_key_exists()
...
Fixes vimeo/psalm#10346
2024-01-27 13:41:43 +01:00
Evan Shaw
68a1d1e2b4
Switch condition order
...
This change is for forward-compatibility with nikic/php-parser 5.0,
where `InterpolatedStringPart` (née `EncapsedStringPart`) is no longer an expression.
Thus we can't pass it to `NodeTypeProvider::getType()` anymore. Since that call
returns `null` anyway, we can swap the condition order. Everything still
works and Psalm type-checking is happy.
This also might be a tiny performance improvement since it lets the
common, cheap instanceof check come before a method call, but I haven't actually
benchmarked it.
2024-01-24 15:38:39 -10:00
f7edaa66ac
Fix #10552
2024-01-18 20:33:54 +01:00
kkmuffme
2414070849
simplify and remove redundant variable
2024-01-15 10:11:22 +01:00
kkmuffme
19b1a33a20
fix possibly undefined array key in keyed array doesnt include null when not validated
...
Fix https://psalm.dev/r/b153d0d248 to return 'a'|null instead of 'a' - this is required as otherwise empty would report RedundantCondition errors now which would bring back https://github.com/vimeo/psalm/issues/2681
2024-01-15 10:11:22 +01:00
kkmuffme
fb93aede12
create a separate issue type
2024-01-15 10:11:21 +01:00
kkmuffme
f3543ca9ab
add the fix for empty() too and fix empty returning bool on true/false only cases hiding errors when functions called
2024-01-15 10:11:21 +01:00
kkmuffme
d5b713e439
Fix https://github.com/vimeo/psalm/issues/10501 - report error for non-strict comparison on truthy+falsy union
2024-01-15 10:11:21 +01:00
orklah
b9583493b0
Merge pull request #10499 from kkmuffme/fix-empty-string-becomes-non-empty-string-when-literal-strings-disabled
...
Fix empty literal string becomes non-empty-string
2024-01-14 23:41:50 +01:00
kkmuffme
02467fbb6a
add support for extract to set variables for keyed arrays and respect EXTR_SKIP
2024-01-14 10:54:02 +01:00
kkmuffme
7f0f0bc361
ensure concat https://psalm.dev/r/323e33ae8a will be a non-falsy-string
2024-01-13 17:10:19 +01:00
orklah
17cd6a7968
Merge pull request #10518 from samlitowitz/issue-10490
...
Deprecated Template Classes are not ignored by @psalm-suppress DeprecatedClass
2024-01-10 22:01:02 +01:00
orklah
b4ad9c00c5
Merge pull request #10505 from kkmuffme/fix-readonly-properties-by-reference-not-reported
...
Add error when using readonly property in by-ref arg
2024-01-09 22:01:51 +01:00
Sam L
a60de4bac8
Whitelist suppressed issue types to for template extended params
2023-12-28 07:50:36 -05:00
Sam L
21617c7029
Include suppressed issues from the class the template is being used by
2023-12-28 07:50:36 -05:00
kkmuffme
9e463bbe75
make tests work in PHP < 8.2
2023-12-19 11:37:14 +01:00
kkmuffme
1ff8518888
Fix https://github.com/vimeo/psalm/issues/9840
2023-12-19 11:07:11 +01:00
kkmuffme
f8a53ebc5d
Fix callable without args not handled correctly
2023-12-18 12:48:13 +01:00
mu3ic
c8748dc5c9
Add trim() in global use
2023-12-14 09:54:32 +03:00
mu3ic
2ce340782e
Fix Uncaught RuntimeException: PHP Error: Uninitialized string offset 0 when $pattern is empty
2023-12-14 09:44:28 +03: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
6363b57c33
fix bug equality assertion with int and float setting wrong type - required so previous commit works
2023-12-13 14:43:55 +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
orklah
93c7a8fd63
Merge pull request #10452 from theodorejb/patch-1
...
Fix remaining POSIX-only absolute path detection
2023-12-07 18:08:57 +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
d5bac4d51d
Emit AfterCodebasePopulatedEvent even on partial scans
2023-12-07 12:46:34 +01:00
Theodore Brown
b5ee6e0d8b
Replace remaining POSIX only absolute path detection
...
These were missed in #10441 . Fixes "Could not resolve config path" error on Windows (#10418 ).
2023-12-06 13:48:06 -06:00
4ed0fe934f
Fix shaped array class string key combination
2023-12-06 14:12:19 +01:00