Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ability to get service by Reference #136

Merged
merged 1 commit into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public function has($id): bool
*/
public function get($id)
{
$id = $this->getId($id);
if (!isset($this->instances[$id])) {
$this->instances[$id] = $this->build($id);
}
Expand Down Expand Up @@ -191,11 +190,6 @@ private function validateDefinition($definition): void
throw new InvalidConfigException('Invalid definition:' . var_export($definition, true));
}

private function getId($id): string
{
return is_string($id) ? $id : $id->getId();
}

/**
* @param string $id
*
Expand Down
13 changes: 0 additions & 13 deletions tests/Unit/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,6 @@ public function testReferencesInArrayInDependencies(): void
$this->assertSame($container->get('engine4'), $moreEngines['more']['more']['engine4']);
}

public function testGetByReference(): void
{
$container = new Container([
'engine' => EngineMarkOne::class,
'e1' => Reference::to('engine'),
]);
$one = $container->get(Reference::to('engine'));
$two = $container->get(Reference::to('e1'));
$this->assertInstanceOf(EngineMarkOne::class, $one);
$this->assertInstanceOf(EngineMarkOne::class, $two);
$this->assertSame($one, $two);
}

public function testSameInstance(): void
{
$container = new Container([
Expand Down