Skip to content

default_index_method no longer works with contiguous integers since 7.0 #60651

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy