orklah
7c4228fb56
Merge pull request #8324 from Nicelocal/fix_union_assertions
...
Fix union assertions
2022-07-28 19:06:14 +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
AndrolGenhald
285740a753
Merge branch '4.x'
2022-07-07 15:01:38 -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
Matt Brown
fccc366c1e
Merge pull request #7887 from ging-dev/lsp-fixes
...
improve LSP
2022-04-27 10:13:17 -04:00
Matt Brown
0c65a19554
Allow null to ArrayAccess::offsetSet $offset param
2022-04-27 01:34:09 -04:00
Fran Moreno
ff195e76c9
Allow null to ArrayAccess::offsetSet $offset param
2022-03-06 13:47:32 +01:00
8d0c1c62e8
Ensure all template parameters are specified in classes, interfaces, traits
2022-01-31 10:06:31 +01:00
orklah
0592c03cda
fix issues resulting from previous commit
2022-01-30 16:05:38 +01:00
AndrolGenhald
558208e44e
Add type checking for class const assignments, fix several other const issues.
2022-01-22 17:06:54 -06:00
Matthew Brown
b49682a485
Simplify issue suppression in tests
2022-01-13 14:38:17 -05:00
Matthew Brown
f439d6550b
Ensure that all entries in test arrays have explicit keys ( #7386 )
...
* Transformation that updates assertions
* Simplify transformation
* Ensure that all tests have keys
* Fix a few remaining keys
2022-01-13 13:49:37 -05:00
Bruce Weirdan
ab60d311c2
Merge pull request #7188 from vimeo/muglug-use-invalidscalarargument-less
2022-01-03 06:04:42 +02:00
orklah
d912663da4
remove isEmpty
2022-01-03 04:10:41 +02:00
orklah
0747b48d06
remove TEmpty
2022-01-03 04:09:59 +02:00
Matthew Brown
b419c299e3
Use InvalidScalarArgument only when we can be sure PHP attempts coercion
2022-01-02 14:56:18 +02:00
546438bec1
Another small fix
2021-12-30 12:05:03 +01:00
ff7abec2bd
Fix tests
2021-12-30 12:01:25 +01:00
orklah
cc618bc916
allow successful destructuring to also be null if the source was nullable
2021-12-20 22:48:27 +01:00
rarila
97e6511fab
Set number of lines before and after namespace.
2021-12-15 04:58:32 +01:00
orklah
574c8f74dd
fix test
2021-12-07 19:48:37 +01:00
orklah
c17af4128e
don't stop analyzing array, even if we already have a type and we can't create an object like
2021-12-07 19:38:52 +01:00
ralila
8fb2e0f885
Handle some partials
2021-12-04 21:55:53 +01:00
ralila
245920e53c
Import instead of using fqn
2021-12-03 20:11:20 +01:00
1129ab1475
Raise RedundantCast when using array_values on a list
2021-11-26 21:47:14 +01:00
orklah
c96be1f68e
fix tests
2021-10-13 11:47:57 +02:00
orklah
758acccb91
fix tests
2021-10-13 11:43:17 +02:00
orklah
c4eb548603
more precise type
2021-10-13 11:22:40 +02:00
orklah
83f2cf2eac
switch the test from invalid to valid
2021-10-13 11:22:40 +02:00
orklah
690c24f824
array unpacking with strings
2021-10-13 11:22:40 +02:00
orklah
b9f14f8687
improve min/max inference, add a return type provider for rand, mt_rand and random_int
2021-10-02 09:53:58 +02:00
orklah
9ca771286f
fix test
2021-08-09 21:18:19 +02:00
orklah
e688781383
seal the result of two sealed KeyedArrays
2021-08-09 20:43:17 +02:00
orklah
79478a60b1
Allow class constant as offset key ( #5943 )
...
* allow class-constant as an array offset when the type match
* remove object with __toString as a possible offset as it's not valid
2021-06-17 18:15:57 -04:00
Matt Brown
b33f87f68d
Treat all assignment operations as equivalent binary ops
2021-06-04 14:39:38 -04:00
Matt Brown
ccd50fdb34
Fix ##5795 - array casts should always be lists
2021-05-19 15:17:50 -04:00
Matt Brown
12844621b4
Fix #5693 - revert fix for #2048
...
The original fix was just a bit too narrow, and led to this bug
2021-05-01 21:13:42 -04:00
AndrolGenhald
de5a031088
Improve @no-named-arguments support and variadics. ( #5455 )
...
* Improve @no-named-arguments support and variadics.
Handling of argument unpacking and variadics still needs a pretty big makeover, but this is a good start.
Fixes #5420
Improves #5453 (iterable works, array still causes issues)
* Remove unneeded imports.
2021-03-22 19:58:22 -04:00
AndrolGenhald
0579c1109b
Fix bugs with array spread operator ( fixes #5421 ) ( #5433 )
2021-03-19 22:43:58 -04:00
AndrolGenhald
17f23ccb30
Fix false-positive with non-empty object like array ( fixes #5436 ) ( #5437 )
2021-03-19 21:54:01 -04:00
AndrolGenhald
b859fba52d
Fix array spread false negative that crashes ( fixes #5431 , reverts #2852 ) ( #5432 )
2021-03-19 21:51:36 -04:00
AndrolGenhald
d4590711d6
Fix object-like array keys when combining string and automatic keys ( fixes #5427 ). ( #5428 )
...
* Fix object-like array keys (fixes #5427 ).
* Fix incorrect return types for tests.
* Fix false positive list with literal int key.
2021-03-19 21:44:44 -04:00
orklah
7a40443ffb
don't throw InvalidArrayOffset when dealing with templates ( #5019 )
2021-01-14 16:35:06 -05:00
orklah
f9fccb2b2d
implement DTO for plugins ( #4881 )
...
* implement DTO for plugins
* introduce EventHandler + reintroduce legacy API for plugins
2021-01-06 09:05:53 -05:00
orklah
3684ceff4c
Illegal offset ( #4865 )
...
* Illegal offset access
* add tests
* fix tests
2020-12-26 10:33:49 +00:00
Matt Brown
6eae582763
Prevent mixed array offset in array creation
...
Fixes #4846
2020-12-16 08:18:18 -05:00
Matt Brown
e702e472fc
Support simple list assignment in foreach
...
Ref #4741
2020-12-06 19:14:52 -05:00
Matt Brown
b64eb6d716
Break out array_key_exists tests
2020-12-02 14:42:16 -05:00