What Happened
Environment
- PHP: 8.4.x (reproducible on 8.2+)
- Laravel: 12.x
- Pest: 4.1.6
- spatie/laravel-data: 4.x
- OS: macOS (also reproducible in CI Ubuntu)
- Runner: php artisan test (Pest driver) and ./vendor/bin/pest
Expected behavior
Pest should surface the PHP fatal error (signature incompatibility) in the console output, so it’s clear why the process failed.
Actual behavior
The process exits with code 255 and prints no error/stack trace when invoked via php artisan test (and sometimes via pest),
making it hard to diagnose. The only way to see the fatal is to require the class directly (php -r "require 'vendor/autoload.php';
class_exists('\App\Data\DemoShippingData');"), which then shows:
Fatal error: Declaration of App\Data\DemoShippingData::from(...) must be compatible with Spatie\LaravelData\Data::from(...):
static
How to Reproduce
Minimal reproduction
- Fresh Laravel + Pest install.
- Add a single class that extends Spatie Data and overrides from with a non‑compatible return type:
// app/Data/DemoShippingData.php