3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Entity {} class ShipmentEntity extends Entity { public ?string $salesChannelId = null; public SalesChannelEntity $salesChannel; } $shipment = new ShipmentEntity(); // Sales channel was not loaded therefore the property is not initialized: var_dump($shipment->salesChannel); // Fatal error: Uncaught Error: Typed property ShipmentEntity::$salesChannel must not be accessed before initialization in /in/CPlqC:11

preferences:
24.84 ms | 404 KiB | 5 Q