Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.4: Implicitly marking parameters as nullable is deprecated #195

Open
jamieburchell opened this issue Oct 9, 2024 · 0 comments
Open

Comments

@jamieburchell
Copy link

jamieburchell commented Oct 9, 2024

A couple of function argument tweaks are required for PHP 8.4 compatibility. Specifically:

    /**
     * Create a new temperature object.
     *
     * @param Unit $now The current temperature.
     * @param Unit $min The minimal temperature.
     * @param Unit $max The maximal temperature.
     * @param Unit $day The day temperature. Might not be null.
     * @param Unit $morning The morning temperature. Might not be null.
     * @param Unit $evening The evening temperature. Might not be null.
     * @param Unit $night The night temperature. Might not be null.
     *
     * @internal
     */
     public function __construct(Unit $now, Unit $min, Unit $max, Unit $day = null, Unit $morning = null, Unit $evening = null, Unit $night = null)

becomes:

public function __construct(Unit $now, Unit $min, Unit $max, Unit $day = null, ?Unit $morning = null, ?Unit $evening = null, ?Unit $night = null)

and

    /**
     * Create a new wind object.
     *
     * @param Unit $speed     The wind speed.
     * @param Unit $direction The wind direction.
     *
     * @internal
     */
    public function __construct(Unit $speed, Unit $direction = null)

becomes

public function __construct(Unit $speed, ?Unit $direction = null)

The ability to mark parameters as nullable was introduced in PHP 7.1. I note your composer.json requires PHP >= 7.0

Happy to open a PR too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant