10000 Deprecation warning in PHP 8.4 for v2.1.8: Implicitly nullable parameter types · Issue #379 · amphp/http-server · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Deprecation warning in PHP 8.4 for v2.1.8: Implicitly nullable parameter types #379
Open
@jkratky

Description

@jkratky

Hello, I've been using this library and noticed that version 2.1.8 triggers deprecation warnings in PHP 8.4 due to implicitly nullable parameter types, as outlined in this RFC. I see that this issue has already been addressed in version 3.x, but I need to use v2.1.8, which still contains the deprecations.

Error example:

Deprecated: Amp\Http\Server\HttpServer::__construct(): Implicitly marking parameter $options as nullable is deprecated, the explicit nullable type must be used instead in src/HttpServer.php on line 90

This happens because parameters that allow null but do not explicitly use ? in their type declaration are deprecated in PHP 8.4.

Example of the issue in v2.1.8:

 public function __construct(
        array $servers,
        RequestHandler $requestHandler,
        PsrLogger $logger,
        Options $options = null
    ) { /* ... */ }

PHP 8.4-compatible fix:

 public function __construct(
        array $servers,
        RequestHandler $requestHandler,
        PsrLogger $logger,
        ?Options $options = null
    ) { /* ... */ }

Would it be possible to fix this in v2.x?

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

      0