Repository navigation
Commit b2ebd76
committed
[Php71] Skip AssignArrayToStringRector on a variable re-assigned as string
PHPStan 2.2.8 infers a possibly undefined variable as ErrorType, where it used to be a union of its possible types. AssignArrayToStringRector leaned on that union to skip:
if (empty($where)) {
$where = '';
} else {
$where = 'WHERE ' . implode(' AND ', $where);
}
With ErrorType, neither the isArray() nor the UnionType guard matches, and the empty string turned into an array, breaking the concat that follows.
The variable being filled as a string later on is what makes it a string here, so that is now checked directly. An empty string assign does not count, as it is a candidate for the very same re-type.1 parent 006fdc1 commit b2ebd76
1 file changed
Lines changed: 59 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
240 | 295 | | |
241 | 296 | | |
242 | 297 | | |
| |||
258 | 313 | | |
259 | 314 | | |
260 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
261 | 320 | | |
262 | 321 | | |
263 | 322 | | |
| |||
0 commit comments