Skip to content

$jsonApi must not be accessed before initialization #5

@nikitasunrise

Description

@nikitasunrise

Typed property LaravelJsonApi\Encoder\Neomerx\Document::$jsonApi must not be accessed before initialization

The class code explicitly declares the variable as null, but does not set a default value like the closest fields.

/**
 * @var JsonApi|null
 */
private ?JsonApi $jsonApi;

/**
 * @var Links|null
 */
private ?Links $links = null;

/**
 * @var Hash|null
 */
private ?Hash $meta = null;

I get this error when I try to disable in my responses top-level JSON:API member (jsonapi filed).
The class Document.php also implements the method withoutJsonApi(). Using which you could disable this field, but not used anywhere

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions