Thanks to visit codestin.com
Credit goes to github.com

Skip to content

default_index_method no longer works with contiguous integers since 7.0 #60651

Closed
@Bilge

Description

@Bilge

Symfony version(s) affected

7.2.7

Description

Worked fine in 6.4, but now it seems to be completely ignored in 7.x. The tagged locator just uses the class name as the key now, ignoring the value returned by default_index_method, despite the fact that the method is still called at container compile time. In case it matters, my index method returns in int.

How to reproduce

Tag some services.

services:
  _instanceof:
    Org\AbstractUnpacker:
      tags:
        - unpacker

Inject services.

services:
  Org\Unpacker:
    arguments:
      $unpackers: !tagged_locator
        tag: unpacker
        default_index_method: getVersion
namespace Org;

abstract class AbstractUnpacker
{
    abstract public static function getVersion(): int;
}

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions