File tree Expand file tree Collapse file tree 2 files changed +2
-12
lines changed
Expand file tree Collapse file tree 2 files changed +2
-12
lines changed Original file line number Diff line number Diff line change 44 - `array_first(array $array): mixed` - Get first value (or `null` if empty)
55 - `array_last(array $array): mixed` - Get last value (or `null` if empty)
66
7- - The `#[\NoDiscard]` attribute warns when a function's return value is ignored. Use `(void)` cast to suppress intentionally .
7+ - Use `clone($object, ['property' => $ value])` to modify properties during cloning—ideal for readonly classes .
88
99### Pipe Operator
1010- The pipe operator (`|>`) chains function calls left-to-right, replacing nested calls:
1515// After PHP 8.5
1616$slug = $title |> trim(...) |> (fn($s) => str_replace(' ', '-', $s)) |> strtolower(...);
1717</code-snippet >
18-
19- ### Clone With
20- - Properties can be modified during cloning using `clone($object, ['property' => $value])`:
21- <code-snippet name =" Clone With Example" lang =" php" >
22- // Before PHP 8.5 (readonly classes required manual reconstruction)
23- $new = new User(...get_object_vars($user), role: 'admin');
24-
25- // After PHP 8.5
26- $new = clone($user, ['role' => 'admin']);
27- </code-snippet >
Original file line number Diff line number Diff line change 2424 "laravel/roster" : " ^0.2.9"
2525 },
2626 "require-dev" : {
27- "laravel/pint" : " ^v1.26 .0" ,
27+ "laravel/pint" : " ^v1.20 .0" ,
2828 "mockery/mockery" : " ^1.6.12" ,
2929 "orchestra/testbench" : " ^8.36.0|^9.15.0|^10.6" ,
3030 "pestphp/pest" : " ^2.36.0|^3.8.4|^4.1.5" ,
You can’t perform that action at this time.
0 commit comments