Skip to content

Issue with ::class and Missing Return Statement in CI #335

@Morgy93

Description

@Morgy93

Hello,

I’m encountering an issue where referencing a class with ::class causes the referenced class to throw the following error in CI (but not locally):

Method Two::getDependencies() should return array but return statement is missing.

As an example, this happens when working with data patches that have dependencies:

<?php

declare(strict_types=1);

use Magento\Framework\Setup\Patch\DataPatchInterface;

class One implements DataPatchInterface
{
    public static function getDependencies(): array
    {
        return [
            Two::class, // <--------------------------------------------------------------
        ];
    }
}
<?php

declare(strict_types=1);

use Magento\Framework\Setup\Patch\DataPatchInterface;

class Two implements DataPatchInterface
{
    public static function getDependencies(): array
    {
        return [];
    }
}

In this setup, the error is thrown in CI, even though everything runs fine locally.

Has anyone experienced this behavior? Could it be related to a specific configuration?
Any guidance on resolving this discrepancy would be greatly appreciated.

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