Skip to content

Deprecation warning on PHP 8.4: Implicitly marking parameter $interpolation as nullable #6

Description

@yakoffka

Hello,

Thank you for your useful package.

After upgrading our project to PHP 8.4 and Laravel 11, we started seeing deprecation warnings from your package in the logs. The warning looks like this:

ErrorException: Runalyze\DEM\Provider\AbstractFileProvider::__construct(): Implicitly marking parameter $interpolation as nullable is deprecated, the explicit nullable type must be used instead
in /var/www/vendor/runalyze/dem-reader/src/Provider/AbstractFileProvider.php:46

This happens because in one of the method signatures, a parameter is given a default value of null but is not explicitly marked as nullable.
In PHP 8.4, implicitly marking a parameter as nullable in this way is deprecated and may cause errors in future PHP versions.

// instead of
public function __construct($pathToFiles, InterpolationInterface $interpolation = null)
// should be (explicit nullable)
public function __construct($pathToFiles, ?InterpolationInterface $interpolation = null)

If you need any help, I can prepare a pull request with the fix.
Thank you for your understanding and for your great work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions