Skip to content

[REQ][php] Implicitly nullable parameter declarations deprecated in PHP8.4 #20241

@77web

Description

@77web

Is your feature request related to a problem? Please describe.

Implicitly nullable parameter declarations has been deprecated in PHP8.4.
You'll run into "deprecated" errors if you execute a php code using API client generated by this generator on PHP8.4.

PHP functions/methods now should declare nullable parameter explicitly:

class Foo implements ModelInterface
{
    // ...
-    public function __construct(array $data = null)
+    public function __construct(?array $data = null)
    {
        $this->setIfExists('some_field', $data ?? [], null);
    }
}

## Describe the solution you'd like

Update templates for php to declare nullable explicitly.

## Describe alternatives you've considered

Do not allow nullable parameters by deleting `= null`.

## Additional context

https://www.php.net/releases/8.4/en.php
https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions