laravel-10-noteslisted
Install: claude install-skill hmj1026/dhpk
# Laravel 10 — native types, invokable rules, Process facade
Released February 2023. PHP 8.1+ floor.
---
## Signature features
### Native return types in app skeleton
Generated artifacts now include native PHP type declarations
everywhere:
```php
// Before (Laravel 9 generator)
public function index() {
return view('users.index');
}
// After (Laravel 10 generator)
public function index(): View {
return view('users.index');
}
```
The framework itself also typed previously-untyped public methods. Most
of these don't break user code, but **strict child classes** that
override framework methods may now produce LSP errors.
Audit point: a Laravel 9 → 10 upgrade should run static analysis
(PHPStan / Psalm) to catch override signature drift.
### Invokable validation rules
```php
final class OrderHasStockRule implements ValidationRule
{
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if (! Stock::availableFor($value)) {
$fail('The :attribute references an out-of-stock SKU.');
}
}
}
// Usage
$request->validate(['sku' => ['required', new OrderHasStockRule]]);
```
Replaces the older `Rule` interface (still works, deprecated). Cleaner
signature; closure-based failure reporting; testable in isolation.
### Process facade
```php
$result = Process::run('ls -la');
if ($result->successful()) {
echo $result->output();
} else {
Log::error('ls failed', ['code' => $result->exitCode(), 'err' => $