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
@@ -119,6 +119,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
119
119
120
120
### Fixed
121
121
122
+
- **An argument written as an array element, a global constant, or a simple operator expression is no longer read as nothing.** `str_replace()`, `preg_replace()`, and any `@template` binding all decide part of their answer from the argument's own source text, and several ordinary ways of writing that argument left them with nothing to go on: `str_replace('a', 'b', $data['message'])` where `$data` is `array{message: string}`, `preg_replace('/-.*/', '', PHP_VERSION)`, and `preg_replace('/\s+/', ' ', $body ?: '')` all kept the full undecided union of both replace branches, even though assigning the same expression to a variable first resolved it correctly. An array-shape or generic element now reads its own value type instead of only the class-backed results the general resolver reported; a bare identifier that names a global constant is read through the same constant lookup hover already uses; and concatenation (always `string`) and the elvis operator (the union of both sides) are read directly rather than being mistaken for a bare variable name.
122
123
-**A fully-qualified type-guard call narrows like its unqualified spelling.**`\is_array($x)`, the style PHP-CS-Fixer's `native_function_invocation` rule enforces, kept the leading backslash in the function name PHPantom compared against `is_array`, `is_string`, and the rest, so the comparison never matched and the guard was silently ignored in both branches. The same held for `\is_a()`, `\class_exists()` and its siblings, and `\property_exists()`/`\method_exists()`. All four narrowing checks now strip a leading backslash before matching, so a project that fully qualifies its builtin calls narrows exactly as one that does not.
123
124
-**Formatting a `.blade.php` file is a no-op.**`textDocument/formatting` handed Blade markup straight to the Pint/php-cs-fixer/phpcbf/mago pipeline with no check on the file's extension, so running "Format Document" on a template sent directives, `{{ }}` echoes, and component tags through a PHP formatter, which most likely errored out or produced nonsense edits. Formatting now returns no edits for a `.blade.php` file (matched the same way completion and hover already recognise Blade, so it also covers a file opened with a `blade` language ID that lacks the extension) until real Blade-aware formatting lands.
124
125
-**An array literal whose keys are out of order no longer passes for a list.**`list{string, string}` and `list<string>` promise the keys run `0, 1, 2, …` in that order, which is what `array_is_list()` answers `true` for, and `[1 => 'x', 0 => 'y']` does not hold. PHPantom accepted it silently: a `list{…}` was read as the `array{…}` it prints as, and a shape's keys were never compared against the order a list requires. The promise is part of the type now, so a parameter written as a list is reported for a literal whose keys are reversed, gapped, or named, and the message says the order is the complaint rather than leaving two near-identical type expressions to be diffed by eye. Hover also spells such a parameter back the way it was written instead of widening it to an `array{…}`. Only a literal written out at the call site is judged, since an array built up across assignments lists the keys we saw in the order we saw them, which says nothing about the order the value's keys are really in.
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
@@ -98,7 +98,6 @@ unlikely to move the needle for most users.
98
98
| D17 |[`docblock_native_mismatch` only judges nullability](todo/diagnostics.md#d17-docblock_native_mismatch-only-judges-nullability)| Low | Medium |
99
99
||**[Bug Fixes](todo/bugs.md)**|||
100
100
| B125 |[A class narrowed by `instanceof` keeps an array alternative from before the check](todo/bugs.md#b125-a-class-narrowed-by-instanceof-keeps-an-array-alternative-from-before-the-check)| High | Medium |
101
-
| B124 |[An argument's type is read from its source text, and several ordinary spellings read as nothing](todo/bugs.md#b124-an-arguments-type-is-read-from-its-source-text-and-several-ordinary-spellings-read-as-nothing)| Medium | Medium |
102
101
||**[Code Actions](todo/actions.md)**|||
103
102
| A40 |[Generate method from call](todo/actions.md#a40-generate-method-from-call)| Medium-High | Medium |
104
103
| A41 |[Create class from non-existing name](todo/actions.md#a41-create-class-from-non-existing-name)| Medium | Medium |
0 commit comments