-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolver: fixed collision of references and autowired arguments
- Loading branch information
Showing
2 changed files
with
59 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* Test: Nette\DI\Compiler and service referencing. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use Nette\DI; | ||
use Tester\Assert; | ||
|
||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
|
||
class Lorem | ||
{ | ||
/** @array */ | ||
public $args; | ||
|
||
|
||
public function __construct($arg1 = '@foo', $arg2 = '@@foo', $arg3 = '@\stdClass') | ||
{ | ||
$this->args = func_get_args(); | ||
} | ||
} | ||
|
||
|
||
$container = createContainer(new DI\Compiler, ' | ||
services: | ||
- stdClass | ||
a: Lorem(3 = true) | ||
b: Lorem(3 = Lorem(3 = true)) | ||
c: Lorem(@@test) | ||
'); | ||
|
||
|
||
Assert::same(['@foo', '@@foo', '@\stdClass', true], $container->getService('a')->args); | ||
Assert::equal(['@foo', '@@foo', '@\stdClass', new Lorem('@foo', '@@foo', '@\stdClass', true)], $container->getService('b')->args); | ||
Assert::same(['@test'], $container->getService('c')->args); |