Bruce Weirdan
375fe32992
Update tests/CallableTest.php
2024-03-20 05:32:13 +01:00
kkmuffme
e83530a6c1
report invalid callable if callable cannot be called like this from current context
...
Fix https://github.com/vimeo/psalm/issues/10823
Fix https://github.com/vimeo/psalm/issues/8509
2024-03-20 01:02:54 +01:00
kkmuffme
a59248f5a1
self, parent and static in callable are deprecated since PHP 8.2
...
Fix https://github.com/vimeo/psalm/issues/10837
2024-03-20 01:02:54 +01:00
Bruce Weirdan
f61c7e108f
Merge pull request #10805 from weirdan/10461-allow-more-callable-types-as-subtypes-of-callable
2024-03-20 00:17:24 +01:00
kkmuffme
8efbf386c3
fix bad class
2024-03-19 21:17:26 +01:00
kkmuffme
ea825c626d
Explicitly set value in config to fix warning in tests
2024-03-19 21:06:20 +01:00
kkmuffme
881546340c
fix tests running with other than called PHP binary if called with a non-default PHP binary
...
e.g. you run the tests with a php83 executable but your default php is PHP 7.4, it will suddenly change while running the tests leading to false positive errors
2024-03-19 13:26:25 +01:00
Bruce Weirdan
4ea41cb69a
Merge branch '5.23.x' into 5.x
2024-03-11 21:34:28 +01:00
Aleksandr Zhuravlev
2a91bd6616
Added test for #10807
2024-03-11 20:09:30 +01:00
Bruce Weirdan
4a2cf93d7a
Don't crash on invalid templates
...
Fixes vimeo/psalm#9596
2024-03-11 01:41:52 +01:00
Bruce Weirdan
20c788911f
Allow more callable types as subtypes of callable
...
Fixes vimeo/psalm#10461
2024-03-10 22:23:01 +01:00
Bruce Weirdan
00c2fef25d
Forbid named arguments for ArrayAcccess methods
...
Fixes vimeo/psalm#10533
2024-03-10 00:06:27 +01:00
Bruce Weirdan
739d87dba7
Use wider class-string when combining class strings with intersections
...
Fixes vimeo/psalm#10799
2024-03-09 20:32:20 +01:00
Bruce Weirdan
8e1aa46195
CS fix
...
- trailing commas in calls with anon functions
- useless array docblock
Refs 8d0f603bef
Refs 6ea0278a67
2024-03-09 18:41:51 +01:00
Bruce Weirdan
667a6a7b01
Merge pull request #10779 from weirdan/10755-namespace-anon-classes
2024-03-03 16:27:49 +01:00
Bruce Weirdan
6b9b4b523d
Namespace anonymous classes
...
Fixes vimeo/psalm#10755
2024-03-03 16:21:20 +01:00
Bruce Weirdan
87e2af43f5
Use PHP_VERSION_ID
instead of version_compare()
...
As we do elsewhere
2024-03-03 15:21:22 +01:00
Bruce Weirdan
64a32721e3
Allow the test fixed in vimeo/psalm#10778
2024-03-03 15:16:39 +01:00
kkmuffme
0975c156af
set previous default setting for failing test temporarily
...
Refs https://github.com/vimeo/psalm/issues/10773
2024-03-03 15:10:03 +01:00
kkmuffme
963feb91a7
fix PHP 8 tests running with wrong --php-version=/phpVersion= if not explicitly specified
2024-03-03 15:10:03 +01:00
Bruce Weirdan
ceb290891b
Initial support for named parameters for callables
...
Fixes vimeo/psalm#10766
2024-03-02 19:17:48 +01:00
kkmuffme
a1848a1a14
@since annotations should only infer PHP version in .phpstub files or for @since 8.0.0 PHP
...
Fix https://github.com/vimeo/psalm/issues/10761
2024-03-02 11:52:51 +01:00
kkmuffme
52fb472207
Fix PHP notice - crash on invalid taint-escape
2024-02-29 17:54:51 +01:00
Evan Shaw
22f32c1392
Set inside_isset = false when analyzing arguments
2024-02-27 22:30:10 +13:00
Bruce Weirdan
60badd0a93
Merge pull request #10752 from edsrzf/array-isset-disable-dim
2024-02-27 01:11:12 +01:00
Bruce Weirdan
4eec8bb5e8
Disabled wrong test
2024-02-27 01:04:03 +01:00
Bruce Weirdan
27461c98f6
Strip null used to signify completed iterations in foreach context
...
Even though `Generator::current()` can return `null` once generator is
exhausted, `foreach()` never iterates after iterator ends, so we can
safely remove `null` (unless, of course, generator can yield `null`).
2024-02-27 01:04:03 +01:00
Bruce Weirdan
8a0bc19fa6
Forbid iterating over generators with non-nullable send()
...
Fixes vimeo/psalm#6985
2024-02-27 01:04:03 +01:00
Bruce Weirdan
e9ea999f50
Merge pull request #10738 from MelechMizrachi/vimeo-fix-long-array-consts-false-flag
2024-02-27 00:40:20 +01:00
Evan Shaw
10ed0f3cd6
Set inside_isset false when analyzing ArrayDimFetch dim
2024-02-26 21:47:05 +13:00
Bruce Weirdan
57caade0d1
Skip symlink test on Windows
...
Fixes vimeo/psalm#6449
Symlinks on Windows are rare (and quite unreliable)
2024-02-25 14:29:20 +01:00
Melech Mizrachi
f553392454
Fix a false flag issue with InvalidConstantAssignmentValue being thrown for constants over a certain length. Usually happens with arrays or lists over 100+ entries in length.
...
Check if this type was defined via a dockblock or type hint otherwise the inferred type should always match the assigned type, and we don't even need to do additional checks
There is an issue with constants over a certain length where additional values are added to fallback_params in the assigned_type but not in const_storage_type which causes a false flag for this error to appear. Usually happens with arrays/lists.
Added two separate tests to cover both lists, and arrays to ensure this issue is fixed.
2024-02-23 11:25:34 -07:00
Bruce Weirdan
eeffee7aae
Merge branch '5.22.x' into 5.x
2024-02-23 00:41:03 +01:00
Oliver Hader
4b827d3847
Add more tests for native intersection types in class properties
2024-02-23 00:33:46 +01:00
Bruce Weirdan
4a5f433831
Merge pull request #10729 from ohader/revert-10242-5.x
2024-02-21 17:07:02 -04:00
Bruce Weirdan
3cd9658d29
Allow Override
attribute to be used in pure contexts
...
Fixes vimeo/psalm#10731
2024-02-21 12:25:30 +01:00
kkmuffme
e482c078a7
code style whitespace fixes including for unrelated tests
2024-02-20 22:28:12 +01:00
kkmuffme
9d8080096c
Fix RiskyTruthyFalsyComparison reporting irrelevant errors when there is no explicit truthy/falsy type
2024-02-20 22:28:12 +01:00
Oliver Hader
679aaf0939
Revert "Allow tainted numerics except for 'html' and 'has_quotes'"
2024-02-20 13:55:31 +01:00
kkmuffme
4ac18720aa
Revert https://github.com/vimeo/psalm/pull/10039 and fix type and test
2024-02-19 14:14:24 +01:00
kkmuffme
f035c00a21
Fix non-empty-lowercase-string handling with literal non-lowercase strings
...
* Fix https://github.com/vimeo/psalm/issues/9782 and related issues
* add explicit handling for non-falsy-string to not fallback non-falsy-string and 0 to string
2024-02-19 11:32:52 +01:00
Bruce Weirdan
d3c1222152
Merge pull request #10704 from issidorov/fix-detecting-magic-static-methods
2024-02-17 10:45:23 -04:00
Bruce Weirdan
03fcf68d9e
Allow multiple spaces between type name and type definition
2024-02-15 23:34:17 +01:00
893b60ed0d
Improve parsing of psalm-type
2024-02-15 23:34:16 +01:00
Ivan Sidorov
5a66742e70
Failed and regression tests with suppression "UndefinedMethod"
...
Apply suggestions from code review.
Failed tests:
```
1) MagicMethodAnnotationTest::testValidCode with data set "magicStaticMethodInheritanceWithoutCallStatic"
Psalm\Exception\CodeException: UnusedPsalmSuppress - src/somefile.php:9:58 - This suppression is never used
2) MagicMethodAnnotationTest::testValidCode with data set "magicStaticMethodInheritanceWithoutCallStatic_WithReturnAndManyArgs"
Psalm\Exception\CodeException: TooManyArguments - src/somefile.php:9:6 - Too many arguments for B::bar - expecting 0 but saw 2
```
Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
2024-02-14 22:17:26 +00:00
Ivan Sidorov
37240624f6
Fix description InvalidCodeAnalysisWithIssuesTestTrait
...
Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
2024-02-14 22:17:26 +00:00
Ivan Sidorov
b7a20802da
Fix description in InvalidCodeAnalysisWithIssuesTestTrait
2024-02-14 15:47:10 +00:00
Ivan Sidorov
08a479aede
Rename to TestCase::assertHasIssue
2024-02-14 15:42:44 +00:00
Ivan Sidorov
cfd0fd1554
Use snake_case in TestCase::assertHasIssueType
2024-02-14 15:41:00 +00:00
Ivan Sidorov
db929912fe
Fix message in TestCase::assertHasIssueType
...
Apply suggestions from code review.
Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
2024-02-14 09:57:24 +03:00