Skip to content

self-reference in constructor #240

@MartkCz

Description

@MartkCz

Version: dev-master

$builder->addDefinition($this->prefix('linkGenerator'))
	->setType(LinkGeneratorInterface::class)
	->setFactory(LinkGenerator::class);
final class LinkGenerator implements LinkGeneratorInterface
{

	public function __construct(LinkGeneratorInterface $decorated)

generated service:

public function createServiceLinkGenerator(): LinkGeneratorInterface
{
	return new LinkGenerator($service, $this->getService('http.request'));
}

Yes, I forgot pass service id to definition, but imho it's bug, because variable $service is undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions