flarum / framework

Simple forum software for building great communities.
http://flarum.org/
6.39k stars 834 forks source link

Dk/json api initialization #4002

Closed luceos closed 3 months ago

luceos commented 5 months ago

fix: json api instantiation fails

Currently the JsonApi is heavily used with methods forEndpoint and forResource, these method set their respective properties, which have no value initially. When instantiating the class, an "cannot access before initialization" error because there's no default.

  Typed property Flarum\Api\JsonApi::$endpointName must not be accessed before initialization