1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00
Commit Graph

5380 Commits

Author SHA1 Message Date
Bruce Weirdan
290b65f6dd Allow enum cases to reference constants
Fixes vimeo/psalm#8242
2022-11-10 19:54:45 -04:00
Matthew Brown
d63da1f66e
Prevent array{a: Foo} going cleanly into array<Foo> (#8691)
* Prevent array{a: Foo} going cleanly into array<Foo>

* Add test for new behaviour

* Fix code style issues

* Allow unions to be cloned again

* Simplify params properties
2022-11-10 09:18:27 -05:00
Bruce Weirdan
d81543f83e
Emit DeprecatedInterface when an interface is referenced in a generic
Fixes vimeo/psalm#8617
2022-11-08 20:34:08 -04:00
65d6a469b6 Fix tests 2022-11-08 10:45:21 +01:00
68a5511057 Merge remote-tracking branch 'origin/4.x' into HEAD 2022-11-08 10:25:04 +01:00
Corey Taylor
b87ebd697f Fix assert testing callmap return types 2022-11-06 00:59:55 -05:00
1986c8b4a8
Add support for strict arrays, fix type alias intersection, fix array_is_list assertion on non-lists (#8395)
* Immutable CodeLocation

* Remove excess clones

* Remove external clones

* Remove leftover clones

* Fix final clone issue

* Immutable storages

* Refactoring

* Fixes

* Fixes

* Fix

* Fix

* Fixes

* Simplify

* Fixes

* Fix

* Fixes

* Update

* Fix

* Cache global types

* Fix

* Update

* Update

* Fixes

* Fixes

* Refactor

* Fixes

* Fix

* Fix

* More caching

* Fix

* Fix

* Update

* Update

* Fix

* Fixes

* Update

* Refactor

* Update

* Fixes

* Break one more test

* Fix

* FIx

* Fix

* Fix

* Fix

* Fix

* Improve performance and readability

* Equivalent logic

* Fixes

* Revert

* Revert "Revert"

This reverts commit f9175100c8452c80559234200663fd4c4f4dd889.

* Fix

* Fix reference bug

* Make default TypeVisitor immutable

* Bugfix

* Remove clones

* Partial refactoring

* Refactoring

* Fixes

* Fix

* Fixes

* Fixes

* cs-fix

* Fix final bugs

* Add test

* Misc fixes

* Update

* Fixes

* Experiment with removing different property

* revert "Experiment with removing different property"

This reverts commit ac1156e077fc4ea633530d51096d27b6e88bfdf9.

* Uniform naming

* Uniform naming

* Hack hotfix

* Clean up $_FILES ref #8621

* Undo hack, try fixing properly

* Helper method

* Remove redundant call

* Partially fix bugs

* Cleanup

* Change defaults

* Fix bug

* Fix (?, hope this doesn't break anything else)

* cs-fix

* Review fixes

* Bugfix

* Bugfix

* Improve logic

* Add support for list{} and callable-list{} types, properly implement array_is_list assertions (fixes #8389)

* Default to sealed arrays

* Fix array_merge bug

* Fixes

* Fix

* Sealed type checks

* Properly infer properties-of and get_object_vars on final classes

* Fix array_map zipping

* Fix tests

* Fixes

* Fixes

* Fix more stuff

* Recursively resolve type aliases

* Fix typo

* Fixes

* Fix array_is_list assertion on keyed array

* Add BC docs

* Fixes

* fix

* Update

* Update

* Update

* Update

* Seal arrays with count assertions

* Fix #8528

* Fix

* Update

* Improve sealed array foreach logic

* get_object_vars on template properties

* Fix sealed array assertion reconciler logic

* Improved reconciler

* Add tests

* Single source of truth for test types

* Fix tests

* Fixup tests

* Fixup tests

* Fixup tests

* Update

* Fix tests

* Fix tests

* Final fixes

* Fixes

* Use list syntax only when needed

* Fix tests

* Cs-fix

* Update docs

* Update docs

* Update docs

* Update docs

* Update docs

* Document missing types

* Update docs

* Improve class-string-map docs

* Update

* Update

* I love working on psalm :)

* Keep arrays unsealed by default

* Fixup tests

* Fix syntax mistake

* cs-fix

* Fix typo

* Re-import missing types

* Keep strict types only in return types

* argc/argv fixes

* argc/argv fixes

* Fix test

* Comment-out valinor code, pinging @romm pls merge https://github.com/CuyZ/Valinor/pull/246 so we can add valinor to the psalm docs :)
2022-11-05 22:34:42 +01:00
orklah
205e8cc73e
Merge pull request #8670 from danog/fix_8669
Fix #8669
2022-11-05 22:29:37 +01:00
923f1d2eb7 Possible fix 2022-11-05 22:23:31 +01:00
Bruce Weirdan
81423dc12b
Remove argc and argv elements from $_ENV
Fixes vimeo/psalm#8662
2022-11-05 15:19:21 -04:00
da21229cab Fix #8664 2022-11-05 19:15:46 +01:00
d0be59e16e
Immutable unions (#8627)
* Immutable CodeLocation

* Remove excess clones

* Remove external clones

* Remove leftover clones

* Fix final clone issue

* Immutable storages

* Refactoring

* Fixes

* Fixes

* Fix

* Fix

* Fixes

* Simplify

* Fixes

* Fix

* Fixes

* Update

* Fix

* Cache global types

* Fix

* Update

* Update

* Fixes

* Fixes

* Refactor

* Fixes

* Fix

* Fix

* More caching

* Fix

* Fix

* Update

* Update

* Fix

* Fixes

* Update

* Refactor

* Update

* Fixes

* Break one more test

* Fix

* FIx

* Fix

* Fix

* Fix

* Fix

* Improve performance and readability

* Equivalent logic

* Fixes

* Revert

* Revert "Revert"

This reverts commit f9175100c8452c80559234200663fd4c4f4dd889.

* Fix

* Fix reference bug

* Make default TypeVisitor immutable

* Bugfix

* Remove clones

* Partial refactoring

* Refactoring

* Fixes

* Fix

* Fixes

* Fixes

* cs-fix

* Fix final bugs

* Add test

* Misc fixes

* Update

* Fixes

* Experiment with removing different property

* revert "Experiment with removing different property"

This reverts commit ac1156e077fc4ea633530d51096d27b6e88bfdf9.

* Uniform naming

* Uniform naming

* Hack hotfix

* Clean up $_FILES ref #8621

* Undo hack, try fixing properly

* Helper method

* Remove redundant call

* Partially fix bugs

* Cleanup

* Change defaults

* Fix bug

* Fix (?, hope this doesn't break anything else)

* cs-fix

* Review fixes

* Bugfix

* Bugfix

* Improve logic

* Update
2022-11-04 19:04:23 +01:00
Vincent Langlet
fbaf6afb30 Try 2022-11-03 18:11:01 +01:00
Vincent Langlet
b2f095f1b8 Add tests 2022-11-03 14:39:48 +01:00
Vincent Langlet
4a27322144 serialize is not pure for array of object 2022-11-03 11:48:33 +01:00
Vincent Langlet
ef0a17ee11 Do not report serialize as unused 2022-11-02 22:52:42 +01:00
kkmuffme
e064a0c14d fix unrelated CI error 2022-10-27 09:23:25 +02:00
kkmuffme
87eb83616e add basename return type provider
Like dirname return type provider of https://github.com/vimeo/psalm/pull/8611
2022-10-26 13:03:53 +02:00
Chauncey McAskill
0afd873787
Fix dirname return type provider
Changed:
- Replaced extraction of `$dir_level` literal value to be from the NodeTypeProvider instead of from the statement; based on similar logic in `RoundReturnTypeProvider`.
- Replaced `new` return type creation with `Type` method creation.
- Replaced `null` return with string type.

Fixed:
- Typo on variable name for extracted `StatementsSource`.
- Edge case where `$dir_level` is less than 1.
- Broken unit tests.
2022-10-23 12:11:58 -04:00
Chauncey McAskill
1dfadfa9ec
Add dirname return type provider 2022-10-23 11:56:02 -04:00
orklah
b739b67080
Merge pull request #8594 from kkmuffme/callable-invalidargument-required-param-mismatch-missing-error
ensure callbacks have the required number of params
2022-10-22 12:20:29 +02:00
kkmuffme
7d953dfb90 add tests 2022-10-22 08:53:40 +02:00
orklah
48b8efde99
Merge pull request #8584 from boesing/feature/8521
Enhance type detection for internal php functions `key`, `current`, `end` and `reset`
2022-10-18 00:07:13 +02:00
Maximilian Bösing
eb6bbfb3b5
qa: remove redundant check as !empty already ensures that key does not return null
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-10-17 20:38:34 +02:00
c9ff8c2c67 Prevent re-resolution of static 2022-10-17 20:31:11 +02:00
Maximilian Bösing
7f35bff0d9
feature: enhance type detection for internal php functions key, current, end and reset
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-10-17 20:24:40 +02:00
kkmuffme
2c47d06968 fix tests 2022-10-17 16:25:43 +02:00
7b6e09afc9 Merge branch 'merge_4.x' into immutable_readonly_3 2022-10-17 12:58:41 +02:00
56805ab089 Fix 2022-10-17 12:54:46 +02:00
15f5c593a7 Fix 2022-10-17 12:40:50 +02:00
1abade3c30 Skip 2022-10-17 12:14:07 +02:00
150be5ca22 Update 2022-10-17 10:45:18 +02:00
8d4d0c0e4a Fixes 2022-10-17 10:33:33 +02:00
53e3889745 Fixes 2022-10-17 10:21:26 +02:00
f816c06331 Fix 2022-10-16 14:39:34 +02:00
8518372cad Fixes 2022-10-16 14:23:31 +02:00
34000ca90d Fixes 2022-10-16 13:59:15 +02:00
cbd1a27ea7
Merge branch 'master' into merge_4.x 2022-10-16 13:49:21 +02:00
b79c43a288 Merge remote-tracking branch 'origin/4.x' into merge_4.x 2022-10-16 13:42:43 +02:00
748a74bb2c Merge remote-tracking branch 'origin/4.x' into HEAD 2022-10-16 13:41:27 +02:00
orklah
921801707d
Merge pull request #8583 from gphargreaves/#8484/fix-datetimeimmutable-sub
Correct return type of DateTimeImmutable sub method stub
2022-10-15 14:51:43 +02:00
ADmad
9bd4d7a740 Fix template param for SplDoublyLinkedList.
It's key is always an integer.
2022-10-14 11:54:53 +05:30
Greg Hargreaves
06581ce4b0 Add additional checks for concat of non-empty strings to return non-falsy 2022-10-14 01:54:06 +01:00
Greg Hargreaves
8849e8ca38 Fix test for DateTimeImmutable sub method return type 2022-10-14 00:59:54 +01:00
8c9558c92b Fix #6983, #8564 2022-10-13 13:42:35 +02:00
orklah
bb9aabe5b1
Merge pull request #8570 from Nicelocal/fix_8569
Fix #8569
2022-10-12 20:59:04 +02:00
a7af027645 Fix #8562 2022-10-12 11:40:29 +02:00
3ac0bce203 Fix #8569 2022-10-12 11:24:42 +02:00
Steven Dickinson
68f6ba873e Fix MinMaxReturnTypeProvider when handling TDependentListKeys 2022-10-11 14:13:40 +01:00
Alies Lapatsin
30dc46528d Cleaup $ignoredFunctions 2022-10-09 17:40:36 +03:00
f06c459415 Bugfix 2022-10-07 13:18:57 +02:00
Gregory Hargreaves
41a6afda32 Add check for const with reserved word class 2022-10-07 09:44:10 +01:00
Peter de Blieck
15453d4306 Removed imap_delete and imap_undelete from the ignoredFunctions list. 2022-10-06 14:44:49 +02:00
0155ad7472 Immutable readonly 3 2022-10-03 15:13:47 +02:00
45452c7125 Immutable readonly 2 2022-10-03 14:02:41 +02:00
c2ce7e63da Immutable readonly 1 2022-10-03 11:53:05 +02:00
f11ed46f26 Immutable assertions 2022-10-03 11:32:15 +02:00
ef60a0c88c Fix properties-of on generics&intersections 2022-10-03 11:28:01 +02:00
3abd0b961f Immutable Unions 2022-10-03 10:45:36 +02:00
kkmuffme
328561d388 add code for faster debugging next time 2022-09-22 01:01:08 +02:00
kkmuffme
ce76158085 fix crash in <PHP8 with ResourceBundle
partially reverts https://github.com/vimeo/psalm/pull/8217
2022-09-22 01:01:08 +02:00
kkmuffme
d69e062426 add RiskyCast tests 2022-09-20 10:59:46 +02:00
kkmuffme
d69be4b9a2 objects even with __toString methods cannot be cast to int/float 2022-09-19 21:54:16 +02:00
Ricardo Boss
bf1c0320fd Cherry-pick: Try to provide literal int types when possible (fixes #6966) (#7071)
* Fixed vimeo/psalm#6966

* Only accept >= 0 values for mode argument in round()

* Made round() only return float or literal float values and remove unneeded test

* Registered RoundReturnTypeProvider

* Updated cast analyzer to handle single string literal int values as literal ints

* Fixed psalm errors

* Fix invalid property accesses

* Addressed comments

* Added Tests

* Marked RoundReturnTypeProvider as internal

* Fixed CS
2022-09-19 21:54:16 +02:00
dennis
3a6b709845 Test to describe use statements being applied 2022-09-19 21:09:45 +02:00
dennis
ab690df4da Improved class name generation for @throws annotation 2022-09-19 21:09:45 +02:00
dennis
8ffc747349 Add test to document cross namespace behaviour 2022-09-19 21:09:45 +02:00
dennis
b88d2890e2 Fix existing tests 2022-09-19 21:09:45 +02:00
dennis
44785fadfc Introduce test with code inside namespace 2022-09-19 21:09:45 +02:00
orklah
3b7e508c78
Merge pull request #8473 from kkmuffme/detailed-superglobal-types
make superglobals more specific
2022-09-19 10:48:44 +02:00
kkmuffme
e2e6265ba1 ignore nullable issues for $argv/$argc 2022-09-19 09:45:55 +02:00
Peter van Dommelen
05f28ce8cd Do not widen type to mixed and lose the existing type information when an Any assertion is used.
Fixes #8084.
2022-09-18 17:02:09 +02:00
orklah
5db59910bd
Merge pull request #8491 from HypeMC/array-column-fix
Fix array_column with object and column name null
2022-09-18 11:25:42 +02:00
HypeMC
602e26edd4 Fix array_column with object and column name null 2022-09-17 21:21:33 +02:00
hirokinoue
2f870776e2 add test case derived from issue #7428 2022-09-17 23:02:25 +09:00
hirokinoue
a2118c65d3 add test case reproducing issue #7428 2022-09-17 22:11:28 +09:00
kkmuffme
b701c7074b fix tests for detailed $_SERVER 2022-09-15 19:39:02 +02:00
kkmuffme
5c39e66b15 fix tests 2022-09-15 19:38:51 +02:00
Vincent Langlet
32aedbac58 Add dateTimeModify return type provider 2022-09-14 00:53:12 +02:00
Matthew Brown
d957ff2015
Fix mixed type hole when sending Foo<string> to Foo<mixed> (#8481)
* Fix mixed type hole when sending Foo<string> to Foo<mixed>

* Fix ifThisIs test

* Suppress bugs highlighted with fix

* Fix PHPDoc parsing
2022-09-13 13:13:06 -04:00
kkmuffme
62df25a741 fix test cache inconsistency 2022-09-11 10:28:16 +02:00
kkmuffme
8da5f5eb1a use exceptions instead of error_log for ParserCacheProvider
* use exceptions instead of error_log for ParserCacheProvider like all other cache providers do
* remove duplicate code in ParserCacheProvider
* use same hash as other cache providers
* update Config.php cache directory creation to use same code as ParserCacheProvider
2022-09-11 10:22:48 +02:00
orklah
5cf6fb3574
Merge pull request #8468 from kkmuffme/class-alias-should-not-be-case-insensitive
classlike_alias incorrect casing not handled correctly
2022-09-08 23:03:17 +02:00
orklah
eba63a3821
Merge pull request #8367 from kkmuffme/revert-nullable-curl_multi_getcontent
partial revert nullable type for curl_multi_getcontent
2022-09-08 22:58:29 +02:00
kkmuffme
6e4c1823d6 partial revert nullable type for curl_multi_getcontent
Fix https://github.com/vimeo/psalm/issues/8351

Partially reverts f28ac73777
2022-09-08 21:46:15 +02:00
kkmuffme
4c6abccfb2 fix tests 2022-09-08 21:33:06 +02:00
kkmuffme
1a10654cb3 fix tests 2022-09-08 13:28:43 +02:00
Semyon
f0a8810cf5 Fix ctype_digit assertion bug 2022-09-07 15:49:35 +03:00
Semyon
969c7a098b Make ctype_digit and ctype_lower work as assertions 2022-09-02 17:37:10 +03:00
Aleksandr Zhuravlev
d7097281ba trim(), ltrim(), rtrim() now keep lowercase string attribute 2022-08-31 21:02:20 +12:00
Tim Düsterhus
3c2018a1e0 Configure a correct attribute target in stubs/CoreGenericClasses.phpstub 2022-08-24 21:32:26 +02:00
Vincent Langlet
6bc714c867 Add support for callable in array_reduce 2022-08-24 16:04:22 +02:00
Markus Staab
198347fac7 fix test 2022-08-22 16:58:23 +02:00
Markus Staab
a3d58cf2fd imports 2022-08-22 16:55:26 +02:00
Markus Staab
63915d1e2c added SensitiveParameter, AllowDynamicProperties php 8.2 attributes 2022-08-22 16:44:55 +02:00
orklah
7ee3a81bce
Merge pull request #8370 from someniatko/issue-8363
Ensure we recognize inherited static methods for the first-class callables
2022-08-18 21:50:20 +02:00
0220da0b32
Add tests 2022-08-17 13:30:36 +02:00
Paul Fedorow
8908638219 Fix imageinterlace function signature 2022-08-12 11:22:45 +02:00
Markus Staab
8f6e16add6 added truthy-string alias for non-falsy-string 2022-08-11 16:49:58 +02:00
Teemu Koskinen
89b7b3234b
Add test for #8373
Undefined classes in function dockblocks should not crash psalm.
Test provided by @AndrolGenhald
2022-08-08 23:49:14 +03:00
orklah
57fcc3968e
Merge pull request #8350 from Ocramius/fix/datetime-constructor-is-not-immutable
Added better stubs for `DateTimeImmutable`, highlighting how the constructor is **NOT** immutable
2022-08-07 22:57:43 +02:00
Marco Pivetta
68ffae097e Simplified DateTimeImmutable::format(): always returns a string
Also:

 * a non-empty format string will always lead to `non-empty-string`
 * it seems that you can throw **everything** at `DateTimeInterface#format()`, even null bytes,
   and it will always produce a `string`
2022-08-05 13:21:28 +02:00
someniatko
be02e7e5c7 #8363 - support static as a type parameter in return types of the first-class callables 2022-08-04 17:16:06 +03:00
someniatko
f3d67845c5 #8363 - ensure we recognize inherited static methods for the first-class callables 2022-08-04 17:01:42 +03:00
Bitwise Operators
9f6ce3059d tests: added tests for bitwise-and, bitwise-xor, bitwise-not and boolean-not class constants 2022-08-04 08:52:43 +02:00
kkmuffme
d2be169ce5 update tests 2022-08-03 20:12:18 +02:00
Marco Pivetta
c205d652d1 DateTimeImmutable#sub() always returns another static instance, never false 2022-07-31 18:12:07 +02:00
Marco Pivetta
dcaf610b0a Removed @psalm-immutable marked from MyDate extending DateTimeImmutable
`DateTimeImmutable` is not really immutable, therefore this marker was wrong upfront
2022-07-31 18:08:01 +02:00
24f7920e9a
Fix if propagation (#8326)
* Add failing unit test

* Fix test

* Revert "Add comment for skipped test"

This reverts commit e4f73beb08.

* Revert "Simplify context updates even more"

This reverts commit a32e63f131.

* Revert "Remove special handling for elseifs that breaks for else if"

This reverts commit d7d9ddc653.

* Fix test
2022-07-30 19:20:05 -04:00
Bruce Weirdan
58e87fa5e0
Applied ArraySpreadInsteadOfArrayMergeRector (take 2) 2022-07-29 18:17:21 -04:00
AndrolGenhald
148264305f
Merge pull request #8341 from someniatko/issue-7731
recognize `@psalm-allow-private-mutation` in PHP 8+ constructors
2022-07-29 09:31:20 -05:00
someniatko
0abde258fa #7731 - recognize @psalm-allow-private-mutation in PHP 8+ constructors 2022-07-29 16:50:56 +03:00
someniatko
0c652f72f6 #8330 - take into account that static type may have been unwrapped in ExistingAtomicStaticCallAnalyzer#hasStaticInType() 2022-07-29 12:31:37 +03:00
orklah
7c4228fb56
Merge pull request #8324 from Nicelocal/fix_union_assertions
Fix union assertions
2022-07-28 19:06:14 +02:00
33d8f3a62d
Fix unit tests 2022-07-28 12:03:12 +02:00
6ce32a48d5
Fix 2022-07-27 20:24:24 +02:00
c409675e3e
Fix intersection of final classes 2022-07-27 18:46:07 +02:00
e19589117d
Fix unit test 2022-07-27 17:56:41 +02:00
37274b308f
Add temporary failing test 2022-07-27 17:51:55 +02:00
09fb879428
Fix #8322, #8319 2022-07-27 17:42:48 +02:00
AndrolGenhald
ee68184527 Fix key comparison when unpacking Traversables. 2022-07-26 12:00:05 -05:00
AndrolGenhald
d54eebfe02 Fix various array spread issues.
- Correctly infer `array` and `list` instead of `non-empty-array` and `non-empty-list` (fixes #7296)
 - Add support for spreading string keys (fixes #7297).
 - Show issue when trying to unpack non-iterable
 - Show issue when trying to unpack iterable with non-array-key key
 - Re-added invalid PHP 8.0 tests removed in #6613
 - Unpacked lists with known keys will be inferred as eg `array{0: int, 1: int}<int<0, max>, int>` now but will still be treated as lists
 - Unpacked arrays with known keys will now be inferred as eg `array{a: string, b: string}<int, int>` instead of `array<int|string, int|string>`
2022-07-26 12:00:03 -05:00
Semyon
462ce7138a Make DatePeriod implement Traversable oh PHP 7, rename constructor params 2022-07-25 17:11:36 +03:00
Semyon
9d3253482d Add stub for DatePeriod 2022-07-25 17:11:36 +03:00
AndrolGenhald
ba6270c06a Fix type reconciliation breaking Context::$references_in_scope (fixes #8289). 2022-07-21 14:27:21 -05:00
Oliver Hader
98502d4613
Assert ReconcilerTest::arrayReferencesAreHandled reaches the end 2022-07-20 21:44:28 +02:00
Oliver Hader
ac315fb0a3
Demonstrate flaw in type reconciliation on array references 2022-07-20 20:33:02 +02:00
orklah
85fe7e8bcf
Merge pull request #8283 from AndrolGenhald/feature/value-of-backed-enum
Allow `value-of` to work with backed enums (fixes #7874).
2022-07-20 18:03:58 +02:00
AndrolGenhald
b51b5ac903 Allow value-of to work with backed enums (fixes #7874). 2022-07-18 14:10:06 -05:00
Matthew Brown
e4f73beb08
Add comment for skipped test 2022-07-17 14:06:07 -04:00
Matt Brown
d7d9ddc653 Remove special handling for elseifs that breaks for else if 2022-07-17 12:51:17 -04:00
Matt Brown
8c716f8be7 Support taints in new $_GET["a"] calls 2022-07-15 22:17:59 -04:00
AndrolGenhald
cac9ec957c
Merge pull request #8249 from someniatko/issue-8200
Improve inferring the "final" `static` type when calling static methods inside a different class
2022-07-14 16:41:01 -05:00
someniatko
1e0b572264 #8200 - bikeshedding the tests 2022-07-14 10:03:47 +03:00
orklah
4fbbf820d8
Merge pull request #8228 from othercorey/callmap-nullable
Fix nullable return types for CallMap functions
2022-07-14 09:03:35 +02:00
Corey Taylor
f28ac73777 Fix nullable return types for CallMap functions 2022-07-13 22:44:38 -05:00
someniatko
21a6dd9096 #8200 - move tests to the correct provider ("valid" instead of "invalid") 2022-07-12 21:53:14 +03:00
orklah
416b597d1c
Merge pull request #7994 from aszenz/4.x
Adds support for fixing missing throws doc block
2022-07-12 20:46:14 +02:00
someniatko
ecbceb1d58 #8200 - move Issue8200Test to ClassTemplateTest 2022-07-12 21:38:23 +03:00
someniatko
b3e673d7ec #8200 - flip logic of determining "source" of static type in ExistingAtomicStaticCallAnalyzer::getMethodReturnType() 2022-07-12 21:17:10 +03:00
someniatko
3a5054018b #8200 - generalize ExistingAtomicStaticCallAnalyzer::hasStaticInType() for non-object cases 2022-07-12 21:00:19 +03:00
someniatko
470885e4f1 #8200 - improve inferring the "final" static type when calling static methods inside a different class
differentiate between `static` defined in a class which CALLS a given static method, and `static` defined in the method which IS CALLED.
2022-07-12 13:51:28 +03:00
Jack Worman
3b76ac85dc Count Report Format 2022-07-10 17:50:50 -05:00
AndrolGenhald
285740a753 Merge branch '4.x' 2022-07-07 15:01:38 -05:00
Corey Taylor
31bee0c845 Fix codestyle erors in InternalCallMapHandlerTest 2022-07-06 03:33:34 -05:00
orklah
e28cd128db
Merge pull request #8217 from othercorey/fix-callmap-funcs
Fix several CallMap function signatures
2022-07-06 07:16:13 +02:00
Corey Taylor
b1e3094bae Allow testing expected CallMap return types and ignore functions that currently fail 2022-07-05 17:32:34 -05:00
Corey Taylor
e0ebfe19a2 Fix class functions CallMap signatures 2022-07-05 15:36:09 -05:00
Corey Taylor
2469b6222d Fix extract() CallMap signature 2022-07-05 15:36:09 -05:00
Corey Taylor
c71dcd581e Fix fputcsv() CallMap signature 2022-07-05 15:36:09 -05:00
Corey Taylor
d0dcd543e4 Fix count() CallMap signature 2022-07-05 15:36:06 -05:00
orklah
fbd240b6b6
Merge pull request #8191 from Nicelocal/fix_namespace
Fix namespace of test
2022-06-28 18:32:01 +02:00
4bd5ca7e6f
Fix 2022-06-28 15:46:30 +02:00
367b311021
Fix namespace of test 2022-06-28 15:42:32 +02:00
orklah
7dff408b25
Merge pull request #8077 from boesing/bugfix/5657
Feature: allow non-union assertion types
2022-06-27 20:55:37 +02:00
orklah
06dd975cb5
Merge pull request #8174 from AndrolGenhald/fix-attribute-crash
Fix crash when redefining method with fewer params (fixes #8141).
2022-06-26 13:47:54 +02:00
AndrolGenhald
e751a27eaf Fix crash when redefining method with fewer params (fixes #8141). 2022-06-26 06:27:46 -05:00
orklah
b3038f0936
Merge pull request #8164 from AndrolGenhald/encapsed-literal-strings
Encapsed literal strings
2022-06-26 12:52:33 +02:00
AndrolGenhald
b671117417 Improve @psalm-internal and prevent usage of IssueBuffer::add(). 2022-06-25 02:09:40 -05:00
AndrolGenhald
3aea0987ef Fix non-empty encapsed string check. 2022-06-24 20:28:04 -05:00
AndrolGenhald
2559222f67 More interpolation and concatenation improvements. 2022-06-24 19:22:59 -05:00
orklah
8b7bc07ad6
Merge pull request #8155 from Nicelocal/prohibition_analyzer_clone
Run method call prohibition analyzer when cloning
2022-06-25 01:31:00 +02:00
orklah
9b4c8cb53f
Merge pull request #8151 from othercorey/fix-array-sigs
Fix array_* function signatures
2022-06-24 18:43:00 +02:00
orklah
cd54574616
Merge pull request #8152 from othercorey/fix-filter-var
Fix filter_var and filter_var_array signatures
2022-06-24 18:42:31 +02:00
7a5120c4f7
Run method call prohibition analyzer when cloning 2022-06-24 12:37:33 +02:00
Corey Taylor
3297e35d9a Fix datefmt_* function signatures 2022-06-23 22:55:29 -05:00
Corey Taylor
e1e858512d Fix filter_var and filter_var_array signatures 2022-06-23 21:50:41 -05:00
Corey Taylor
417bf87df0 Fix array_* function signatures 2022-06-23 20:32:29 -05:00
Matt Brown
e6c444410c Remove debug code 2022-06-23 18:03:33 -04:00
Matt Brown
15387d19cd Track taints in static properties 2022-06-23 16:43:42 -04:00
Corey Taylor
b053253513 Fix signatures of ldap_* functions 2022-06-23 04:21:56 -05:00
Sam
de8187d138
Update tests/Internal/Codebase/InternalCallMapHandlerTest.php 2022-06-22 19:04:28 +02:00
orklah
cbc597f80c
Merge pull request #8140 from AndrolGenhald/stubs-dom-simplexml
Update DOM stub and add separate SimpleXML stub
2022-06-22 18:52:45 +02:00
Sam Mousa
c393a20471
fix static analysis comments 2022-06-22 15:37:51 +02:00
Sam Mousa
ac091902c1
php version specific ignores 2022-06-22 15:32:35 +02:00
Sam Mousa
08aea9c8ca
remove debug code 2022-06-22 15:08:50 +02:00
Sam Mousa
f8e548e811
fix code style remove debug code 2022-06-22 15:05:24 +02:00
Sam Mousa
d13a428cb5
update ignores, cleanup test file 2022-06-22 14:57:40 +02:00
Sam Mousa
d2467cfb7e
sort ignore list add more functions to it 2022-06-22 13:28:17 +02:00
Sam Mousa
37549ee03c
add test for ignore list cleanup 2022-06-22 12:59:47 +02:00
AndrolGenhald
4e3c2ea4d0 Fix tests. 2022-06-22 01:53:42 -05:00
Matt Brown
6fa0da9e37 Fix minor taint analysis bug with nested array assignment 2022-06-21 12:42:32 -04:00
Sam
db3447513e
Merge branch '4.x' into automated-callmap-validation 2022-06-15 16:06:36 +02:00
Sam Mousa
f6be3efa42
fix: added more type annotations 2022-06-15 15:05:06 +02:00
Sam Mousa
cc58fd9401
fix: add more typehints 2022-06-15 14:46:50 +02:00
Sam Mousa
df750709cc
fix: ignore last remaining failing function 2022-06-15 13:29:22 +02:00
Sam Mousa
b46f556662
chore: fix cs 2022-06-15 13:28:09 +02:00
Sam Mousa
0e7ea855d0
fix: ignore functions that fail on windows 2022-06-15 13:23:32 +02:00
orklah
c60e0a890c
Merge pull request #8056 from kkmuffme/phpdoc-false-positives-for-partially-invalid
fix false positives for partially invalid phpdoc
2022-06-15 13:21:26 +02:00
Sam Mousa
c3a97e0258
fix: add typehints 2022-06-15 13:16:24 +02:00
Sam Mousa
0484ee1560
chore: remove unused property 2022-06-15 13:13:24 +02:00
kkmuffme
a86dbf3640 update test cases 2022-06-15 12:31:53 +02:00
Sam Mousa
e826110417
fix: ignore all faulty callmap entries and revert callmap changes 2022-06-15 12:09:47 +02:00
Sam Mousa
ded566e79a
fix: callmap improvements and updated ignore list 2022-06-15 10:56:15 +02:00
Sam Mousa
c638006f5b
fix: add memcache family of function to ignore list 2022-06-15 09:27:40 +02:00
Sam Mousa
7bc5721d4c
fix: php8.1 syntax in tests 2022-06-15 09:11:14 +02:00
Sam Mousa
c1c3b20016
fix: more callmap fixes 2022-06-14 16:58:49 +02:00
Sam Mousa
e78c0a5e11
chore: remove undefined skip function 2022-06-14 15:43:13 +02:00
Sam Mousa
1b5a01dd77
wip: lots of fixes to the callmap 2022-06-14 15:16:13 +02:00
Sam Mousa
507e792d91
added more type validity checks to reduce possible false positives 2022-06-13 15:29:21 +02:00
Sam Mousa
c7e39e76fc
tests: add test that validates the callmap in the current runtime 2022-06-13 15:10:23 +02:00
Bitwise Operators
651ad6cb50 release:fix: Change return type of createFromInterface() methods on DateTime and DateTimeImmutable to 'static' so extending classes are recognized. 2022-06-13 14:41:02 +02:00
Maximilian Bösing
7e033d8051
bugfix: do not extend the type - only narrow down
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 19:20:38 +02:00
Maximilian Bösing
92b4bf1f01
qa: use dedicated variable for asserting a specific value
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 02:58:08 +02:00
Maximilian Bösing
083da24551
qa: add more specific unit test(s) for the oneOf detection
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 02:53:04 +02:00
Maximilian Bösing
a9daa3ba02
qa: add failing test for one-of assertion
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-09 00:26:06 +02:00
orklah
02d5beecb0
Merge pull request #8051 from AndrolGenhald/bugfix/8048
Fix possibly empty array shape appearing non-empty (fixes #8048).
2022-06-08 19:22:12 +02:00
AndrolGenhald
271dce8b6c Fix test format after cherry-pick from master. 2022-06-07 19:16:53 -05:00
AndrolGenhald
af5c191e7b Fix generic object comparison to use template constraint as default (fixes #8068). 2022-06-07 19:12:36 -05:00
Bruce Weirdan
4e59398f77
Coerce null to empty string in array keys
Fixes vimeo/psalm#8063

Alters the fix for vimeo/psalm#2165 (1a48be8e9c)

/cc: @iluuu1994, @muglug
2022-06-06 17:41:42 -04:00
AndrolGenhald
c271b1245e Fix possibly empty array shape appearing non-empty (fixes #8048). 2022-06-02 14:00:52 -05:00
AndrolGenhald
2f090e5722 Fix TypeCombiner::combine to not modify TIntRange arguments.
This keeps coming up in obscure places, hopefully this fixes it once and for all. I would reeeaaally love to have an immutable type system at some point...
2022-06-02 12:36:41 -05:00
Bruce Weirdan
de49946e4d
Update empty list/array notation 2022-05-28 16:19:49 -04:00
Bruce Weirdan
ff50516fbd
Post-merge fixes 2022-05-28 15:05:17 -04:00
Bruce Weirdan
e0acf22e40
Merge branch '4.x' into update-master 2022-05-28 14:49:12 -04:00
AndrolGenhald
31b4dceaf4 Improve handling of unsupported references (fixes #8018). 2022-05-26 18:28:23 -05:00
asrar
f94b7abb18 chore: add another test 2022-05-22 18:38:18 +02:00
asrar
e28831dff8 feat: fix ci + preserve existing throws 2022-05-22 18:27:38 +02:00
asrar
c6854cf567 Adds support for fixing missing throws doc block 2022-05-21 17:39:51 +02:00
AndrolGenhald
80e94daefb Fix class const issue when using floats declared in future consts (fixes #7973).
- Calculate literal type for float arithmetic instead of only for int arithmetic
 - Fix copy/paste fail causing InvalidConstantAssignmentValue to be marked as fixable
2022-05-20 14:46:05 -05:00
Matt Brown
990887148c Fix #7968 - combine and simplify types where necessary in ternary analysis 2022-05-19 22:32:14 -04:00
hirokinoue
e7005245b8 add test case for implode() 2022-05-14 23:36:51 +09:00
Theodore Brown
4eef964048 Infer object shape when array or scalar is cast to object
Also detect redundant object casts.

Fixes #7916, fixes #7934
2022-05-09 20:31:29 -05:00
hirokinoue
4bb5c38eb6 add test case for usort() 2022-04-29 00:52:37 +09:00
hirokinoue
139948e774 add test case for uksort() 2022-04-29 00:33:08 +09:00
hirokinoue
d4470cc99e add test case for uasort() 2022-04-29 00:18:27 +09:00
hirokinoue
c7b9e1eebb add test case for shuffle() 2022-04-28 23:18:39 +09:00
hirokinoue
db565f1d32 add test case for rsort() 2022-04-28 23:05:33 +09:00
Matt Brown
1e15ed393a Fix merge conflict with attribute tests 2022-04-27 10:31:58 -04:00
Matt Brown
fccc366c1e Merge pull request #7887 from ging-dev/lsp-fixes
improve LSP
2022-04-27 10:13:17 -04:00
Matt Brown
d064d9fc6c Add test 2022-04-27 01:47:02 -04:00
Matt Brown
2ef993928c Document @psalm-ignore-variable-* 2022-04-27 01:46:13 -04:00
Matt Brown
a9e3c1fdc1 Fix namespaced min/max int range keyword issue introduced in #7775. 2022-04-27 01:44:57 -04:00
Matt Brown
402280d4f9 Merge pull request #7791 from ohader/issue-7771-4x
Avoid json_encode when serializing non-UTF8 literals
2022-04-27 01:44:06 -04:00
Matt Brown
20351c6667 Avoid json_encode when serializing non-UTF8 literals
`\Psalm\Internal\Clause::$hash` basically holds a hash on
arbitrary input literals, used for later comparison. Using
`json_encode` fails when dealing with non-UTF8 literals,
which has been replaced by plain PHP `serialize`.

Resolves: #7771
2022-04-27 01:42:37 -04:00
Matt Brown
d0524c2418 Forbid min bound greater than max bound in int range 2022-04-27 01:38:21 -04:00
Matt Brown
9cc2af56b4 Support Stringable before PhpToken autoloading 2022-04-27 01:36:17 -04:00
Matt Brown
0c65a19554 Allow null to ArrayAccess::offsetSet $offset param 2022-04-27 01:34:09 -04:00
Matt Brown
d58736a550 fix #7747: DateInterval::createFromDateString can be false 2022-04-27 01:32:38 -04:00
hirokinoue
3a6ebbb8ff add test case for sort() 2022-04-24 01:00:38 +09:00
hirokinoue
63faa0c919 test the correct function 2022-04-24 00:54:58 +09:00
hirokinoue
a525342bc7 add test case 2022-04-16 14:05:51 +09:00
orklah
6d0cc07255
Merge pull request #7838 from VincentLanglet/sortTypes
Fix Incompatible types found for T (Stub&ProxyQueryInterface is not in ProxyQueryInterface&Stub)
2022-04-10 10:20:30 +02:00
Jeremiasz Major
5717516f2f
Remove @psalm-generator-return annotation 2022-04-09 22:15:37 +02:00
Vincent Langlet
48bc030eec Add test 2022-04-09 21:59:23 +02:00
Jeremiasz Major
ce25b39b5d
Document @psalm-ignore-variable-* 2022-04-08 00:30:23 +02:00
Jeremiasz Major
e1fe1161bd
Remove documented annotations from wall of shame 2022-04-07 21:44:33 +02:00
Jeremiasz Major
f4f1a26cf9
Document @psalm-yield 2022-04-07 21:43:12 +02:00
orklah
b72f0564bc fix refining lowercase string and non-empty-string together 2022-04-05 21:05:23 +02:00
AndrolGenhald
0bdf9425e3 Fix namespaced min/max int range keyword issue introduced in #7775. 2022-03-30 16:08:14 -05:00