Skip to content

Commit

Permalink
Provide possibility to manually define registry id
Browse files Browse the repository at this point in the history
Drop previous auto-assignment.
  • Loading branch information
bnf committed Sep 12, 2018
1 parent 2269e49 commit 533e354
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
10 changes: 2 additions & 8 deletions src/InteropServiceProviderBridgeBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,13 @@ class InteropServiceProviderBridgeBundle extends Bundle implements RegistryProvi
*/
private $id;

/**
* @var int
*/
private static $count = 0;

/**
* @param array $serviceProviders An array of service providers, in the format specified in bnf/service-provider-registry: https://github.com/bnf/service-provider-registry#how-does-it-work
*/
public function __construct(array $serviceProviders = [])
public function __construct(array $serviceProviders = [], int $id = 0)
{
$this->serviceProviders = $serviceProviders;
$this->id = self::$count;
self::$count++;
$this->id = $id;
}

public function build(ContainerBuilder $container)
Expand Down
4 changes: 2 additions & 2 deletions tests/ServiceProviderCompilationPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

class ServiceProviderCompilationPassTest extends TestCase
{
protected function getContainer(array $lazyArray, $useDiscovery = false)
protected function getContainer(array $lazyArray)
{
$bundle = new InteropServiceProviderBridgeBundle($lazyArray, $useDiscovery);
$bundle = new InteropServiceProviderBridgeBundle($lazyArray);

$container = new ContainerBuilder();
$logger = new Definition(NullLogger::class);
Expand Down

0 comments on commit 533e354

Please sign in to comment.