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

Skip to content

Service implementing ResetInterface with shared: false is not being reset #60903

Open
@FluffyDiscord

Description

@FluffyDiscord

Symfony version(s) affected

7.3

Description

Non-shared services are not being reset when they implement ResetInterface. This kind of makes sense, but they are services non-the-less, so they should be referenced in container and should be resettable.

How to reproduce

<?php

use Symfony\Contracts\Service\ResetInterface;

#[Autoconfigure(
    shared: false,
)]
class Test implements ResetInterface 
{
    public function reset(): void
    {
        dd('Hello!');
    }
}

class Something
{
    public function __construct(private readonly Test $test): void
    {
    }
}

Test->reset() is never called

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