You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,6 +121,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
121
121
122
122
### Fixed
123
123
124
+
-**`array_filter` keeps what its callback proves about the keys.** In the two modes that hand the callback the key (`ARRAY_FILTER_USE_KEY` and `ARRAY_FILTER_USE_BOTH`) the result was reported with the key type it went in with, so `array_filter($data, fn ($k) => is_string($k), ARRAY_FILTER_USE_KEY)` still claimed integer keys the call exists to remove, and passing it on to a parameter declared `array<string, …>` was reported as a mismatch. The keys that survive are now read off the callback the same way an `if (is_string($k))` body is read, whether it is written inline or named (`'is_string'`), and a callback that admits every key it could receive leaves the type alone.
124
125
- **An element write refines what the array already holds.** A write into a variable whose keys were already tracked was thrown away rather than recorded: `$row[] = $pen` on a `array{name: string}` left the shape exactly as it was, and so did `$row[$key] = 1`, so the value that had just been written was not there to read back. Both are now applied. An append takes the next free integer key beside the keys already tracked, an append one level down extends what that key holds instead of leaving it at the value it was initialised with, and a write through a key only known at runtime widens the shape to the keys and values it and the existing entries describe together, since a runtime key may land on any of them. The reverse mistake is gone too: writing a literal key into an array declared by key and value type (`array<string, int>`) rebuilt it as a shape holding that one key, discarding every other key it was known to hold, and appending to a string-keyed array called the result a `list`. Both now keep the array's key and value types and fold the written pair into them.
125
126
-**`+=` no longer forgets what the right side contributes.** Where the left side had no tracked type, `$config += ['slot' => $default]` produced a bare `array`, so the key it had just added was not there to complete or hover on. `+` only accepts arrays, so whatever the left side held was one, and the result now carries what the right side contributes. Two positional arrays union index by index as PHP does, rather than standing down because their entries are written without keys.
126
127
-**An array shape answers the `list` and `non-empty-array` promises from its own entries.** A shape was compared against those types by name alone, so `array{}` satisfied a `non-empty-array` parameter and `array{name: string}` satisfied a `list`, while a real list of values written as `array{string, int}` did not satisfy `list`. A shape is now non-empty when it names a key that is always there, and a list when its keys run `0, 1, 2, …` in order with any optional entry at the end.
Copy file name to clipboardExpand all lines: docs/todo.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,6 @@ unlikely to move the needle for most users.
99
99
| D17 |[`docblock_native_mismatch` only judges nullability](todo/diagnostics.md#d17-docblock_native_mismatch-only-judges-nullability)| Low | Medium |
100
100
||**[Bug Fixes](todo/bugs.md)**|||
101
101
| B151 |[`?T` and `T\|null` are judged by different rules](todo/bugs.md#b151-t-and-tnull-are-judged-by-different-rules)| High | Low-Medium |
102
-
| B152 |[`array_filter` with `ARRAY_FILTER_USE_KEY` does not narrow the key type](todo/bugs.md#b152-array_filter-with-array_filter_use_key-does-not-narrow-the-key-type)| Low-Medium | Medium |
103
102
||**[Code Actions](todo/actions.md)**|||
104
103
| A40 |[Generate method from call](todo/actions.md#a40-generate-method-from-call)| Medium-High | Medium |
105
104
| A41 |[Create class from non-existing name](todo/actions.md#a41-create-class-from-non-existing-name)| Medium | Medium |
0 commit comments