In PHP, your class probably has a typed attribute that's expecting to be filled but isn't yet when you call it. If you don't have this for some reason, like it getting generated by input from an ORM, initialize your typed attributes as null.
For instance, if your error is
"Typed property App\Entity\ThingType::$var must not be accessed before initialization"
private ?ThingType $var;
or
private ThingType $var = null;