Skip to content

[4.4] [Lock] Argument 1 passed to Symfony\Component\Lock\Factory::__construct() must be an instance of Symfony\Component\Lock\StoreInterface, instance of App\Lock\DatabaseStore given #34952

@JohJohan

Description

@JohJohan

Symfony version(s) affected: 4.4+

Description
When creating a custom Lock Store that implements BlockingStoreInterface creating the lock will throw an exception:

argument 1 passed to Symfony\Component\Lock\Factory::__construct() must be an instance of Symfony\Component\Lock\StoreInterface, instance of App\Lock\DatabaseStore given.

Because Symfony\Component\Lock\LockFactory extends Symfony\Component\Lock\Factory which is deprecated and has a deprecated construct param for Symfony\Component\Lock\StoreInterface

How to reproduce

  1. Create a custom Lock Store that implements BlockingStoreInterface
  2. Create the lock using Symfony\Component\Lock\LockFactory you get an exception that you are not implementing Symfony\Component\Lock\StoreInterface

Possible Solution
Symfony\Component\Lock\LockFactory shouldn't extend Symfony\Component\Lock\Factory as this is deprecated.

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