Repository navigation
Commit 81ed009
Do not fire UsedAsStringNode for arguments passed to PHPDoc-only string parameters
A parameter typed only via @PARAM (no native typehint) has a native type of
mixed. The previous "simplify" used !isString()->no() as the slot discriminator,
which treats mixed as a string slot, so an argument passed to such a parameter
fired UsedAsStringNode. Restore the "native type contains a string member"
discriminator (flatten + isString()->yes()) so mixed is excluded while plain
string and string|int still fire. Apply the same check to the property-assignment
slot, which had the same latent mixed-fires issue.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent edb4503 commit 81ed009
3 files changed
Lines changed: 36 additions & 2 deletions
File tree
- src/Analyser
- ExprHandler
- tests/PHPStan/Node/data
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
262 | 268 | | |
263 | 269 | | |
264 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3300 | 3300 | | |
3301 | 3301 | | |
3302 | 3302 | | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
3303 | 3319 | | |
3304 | 3320 | | |
3305 | 3321 | | |
| |||
3743 | 3759 | | |
3744 | 3760 | | |
3745 | 3761 | | |
3746 | | - | |
| 3762 | + | |
3747 | 3763 | | |
3748 | 3764 | | |
3749 | 3765 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
0 commit comments