Skip to content

PHP 8.4: Implicitly nullable parameter in Model constructors triggers deprecation #30

@cursor

Description

@cursor

Description

On PHP 8.4, the library triggers the following deprecation:

ErrorException: Deprecated: RusticiSoftware\Cloud\V2\Model\LaunchLinkSchema::__construct(): 
Implicitly marking parameter $data as nullable is deprecated, 
the explicit nullable type must be used instead

Cause

All Model classes use array $data = null in their constructors. In PHP 8.4, this implicit nullable pattern is deprecated; the parameter must be explicitly nullable.

Suggested fix

Change the constructor signature from:

public function __construct(array $data = null)

to:

public function __construct(?array $data = null)

Scope

This pattern appears in all Model classes under src/Model/ (e.g. LaunchLinkSchema, CourseSchema, RegistrationSchema, and many others).

Environment

  • PHP 8.4.x
  • rustici-software/scormcloud-api-v2-client-php 4.0.0

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