mirror of
https://github.com/flarum/core.git
synced 2025-08-05 07:57:46 +02:00
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 ```
This commit is contained in:
@@ -25,8 +25,8 @@ use Tobyz\JsonApiServer\Resource\Resource;
|
||||
|
||||
class JsonApi extends BaseJsonApi
|
||||
{
|
||||
protected string $resourceClass;
|
||||
protected string $endpointName;
|
||||
protected ?string $resourceClass = null;
|
||||
protected ?string $endpointName = null;
|
||||
protected ?Request $baseRequest = null;
|
||||
protected ?Container $container = null;
|
||||
|
||||
|
Reference in New Issue
Block a user