Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LazyClosure.php

function LazyClosure::__get

File

vendor/symfony/dependency-injection/Argument/LazyClosure.php, line 36

Class

LazyClosure
@author Nicolas Grekas <p@tchwork.com>

Namespace

Symfony\Component\DependencyInjection\Argument

Code

public function __get(mixed $name) : mixed {
    if ('service' !== $name) {
        throw new InvalidArgumentException(\sprintf('Cannot read property "%s" from a lazy closure.', $name));
    }
    if (isset($this->initializer)) {
        $this->service = ($this->initializer)();
        unset($this->initializer);
    }
    return $this->service;
}
RSS feed
Powered by Drupal