Skip to content

Commit 7da7a93

Browse files
committed
Refine PHP 8.5 guidelines
Signed-off-by: Pushpak Chhajed <[email protected]>
1 parent 57578a9 commit 7da7a93

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

.ai/php/8.5/core.blade.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
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:
@@ -15,13 +15,3 @@
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>

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
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",

0 commit comments

Comments
 (0)