Commit 7c463d7
committed
feature #1249 [LiveComponent] Normalize "true" & "false" model values (smnandre)
This PR was merged into the 2.x branch.
Discussion
----------
[LiveComponent] Normalize "true" & "false" model values
| Q | A
| ------------- | ---
| Bug fix? | yes?
| New feature? | no?
| Issues | Fix #1211
| License | MIT
Coerce strings "true" & "false" to their boolean equivalent (same for 0 and 1)
```php
private static function coerceStringToBoolean(string $value): bool
{
$booleanMap = [
'0' => false,
'1' => true,
'false' => false,
'true' => true,
];
return $booleanMap[$value] ?? (bool) $value;
}
```
Is that what you had in mind `@weaverryan` ?
Commits
-------
7fbac61 [LiveComponent] Normalize "true" & "false" model valuesFile tree
2 files changed
+37
-1
lines changed- src/LiveComponent
- src
- tests/Integration
2 files changed
+37
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
| 247 | + | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
252 | 264 | | |
253 | 265 | | |
254 | 266 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1460 | 1460 | | |
1461 | 1461 | | |
1462 | 1462 | | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
1463 | 1477 | | |
1464 | 1478 | | |
1465 | 1479 | | |
| |||
1474 | 1488 | | |
1475 | 1489 | | |
1476 | 1490 | | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
1477 | 1500 | | |
1478 | 1501 | | |
1479 | 1502 | | |
| |||
1484 | 1507 | | |
1485 | 1508 | | |
1486 | 1509 | | |
| 1510 | + | |
1487 | 1511 | | |
1488 | 1512 | | |
1489 | 1513 | | |
| |||
0 commit comments