Skip to content

Commit

Permalink
Do not resolve by parameter name
Browse files Browse the repository at this point in the history
  • Loading branch information
jm42 committed Jun 27, 2017
1 parent a103b2d commit 58e73c4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- PSR-11 support.
- [BC-BREAK] Arguments are not revolved as parameter unless dollar sign is prefix.
- [BC-BREAK] Removed resolve by parameter name.

### 0.8.0

Expand Down
2 changes: 0 additions & 2 deletions library/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ private function buildContext(array $parameters, array $arguments) {
$context[$index] = $resolve($arguments[$name]);
} elseif ($param->hasType() && !$param->getType()->isBuiltin() && isset($this->delegate[strval($param->getType())])) {
$context[$index] = $this->delegate[strval($param->getType())];
} elseif (isset($this->delegate[$name])) {
$context[$index] = $this->delegate[$name];
} elseif ($param->isDefaultValueAvailable()) {
$context[$index] = $param->getDefaultValue();
} elseif ($param->isOptional() && !$param->isVariadic()) {
Expand Down
8 changes: 0 additions & 8 deletions spec/Suite/RegistrySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,6 @@ function __construct(Engine $engine, string $color='red') {
expect($di->make(W16::class))->toBeAnInstanceOf(W16::class);
});

it('creates a concrete class with delegate lookup the parameter name', function() {
$di = new Registry;
$di->offsetSet('left', new V8);
$di->offsetSet('right', new V8);

expect($di->make(W16::class))->toBeAnInstanceOf(W16::class);
});

// require pdo-sqlite
xit('creates a concrete class with no default values but optional', function() {
$di = new Registry;
Expand Down

0 comments on commit 58e73c4

Please sign in to comment.