Skip to content

Indirect deprecation notice #61

Open
@claudiu-cristea

Description

@claudiu-cristea

I see these notice after running PHPUnit tests in a Drupal project

Method "Consolidation\Config\ConfigInterface::import()" might add "Config" as a native return type declaration in the future. Do the same in implementation "Robo\Config\Config" now to avoid errors or add an explicit @return annotation to suppress this message.

However, I don't think we can do the suggested change, even we cover also Robo, because it might break other extending classes

Activity

claudiu-cristea

claudiu-cristea commented on Dec 21, 2023

@claudiu-cristea
Author

Tried to add #[\ReturnTypeWillChange] but the deprecation isn't going away

greg-1-anderson

greg-1-anderson commented on Dec 21, 2023

@greg-1-anderson
Member

I think we only need #[\ReturnTypeWillChange] if we add a return type to the function definition. I think the code breaks for PHP 8.0 and earlier if we do that, though, because #[\ReturnTypeWillChange] was introduced in PHP 8.1.

I think that the error is indicating that an explicit @return is desired in Robo\Config\Config; in theory, though, this shouldn't be necessary, as Robo Config should inherit the @return annotation from ConfigInterface.

Unsure what the right way forward is. Maybe what is needed is a new major version for PHP 8.3+ or wherever this is first introduced. That often implied cascading major version upgrades along the dependency tree, though.

greg-1-anderson

greg-1-anderson commented on Dec 26, 2023

@greg-1-anderson
Member

Can you reproduce this problem with the tests in this repository? I tried running the existing tests with PHP 8.3; I was not too surprised that the problem was not shown by the config tests, but I also did not see the reported error when running the Robo tests.

Could you submit a failing test here that exhibits the same problem that you're seeing in your Drupal module test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @claudiu-cristea@greg-1-anderson

        Issue actions

          Indirect deprecation notice · Issue #61 · consolidation/config